Hi there!
  I'm trying to save the content of an FBO into an image using the
GrabForeground class.. here is the code I use:

        ImagePtr img = Image::create();
        beginEditCP(img);
                img->setPixelFormat(Image::OSG_RGBA_PF);
        endEditCP(img);

        GrabForegroundPtr grabber = GrabForeground::create();
        beginEditCP(grabber);
                grabber->setImage(img);
                grabber->setActive(true);
                grabber->setAutoResize(true);
        endEditCP(grabber);

        m_pFBO->setBackground(SolidBackground::create());
        m_pFBO->setCamera(m_pRenderAgent->getCamera());
        m_pFBO->setScene(makeCoredNode<Group>());
        m_pFBO->addForeground(grabber);
        m_pFBO->render(m_pRenderAgent->getRenderAction());

        // save data
        char path[255] = "c:\\temp";
        boost::filesystem::path p(path);
        p /= ("hithere.png");

        printf("Saving image %s\n", p.string().c_str());
        if (!img->write(p.native_file_string().c_str())) {
                printf("Error writing screenshot\n");
        } else {
                printf("Done writing screenshot\n");
        }

img->write() returns me success, an image with the right dimensions gets saved,
but it's full of (0,0,0,0) while I should get a full black image, right?
Is there something wrong? GrabForeground (and glReadPixels) should work
correctly with FBOs as I'm reading on the web... isn't it?

Thanks a lot,
Stefano Verna



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to