Hello Daniel,

daniel trindade wrote:
> I'm trying to use FBOViewport for rendering to a texture. After drawing 
> the scene, i want to save the image.
> 
> How can i read the image back to the CPU? Reading the posts on the list, 
> i saw that setReadBuffer( true ) would solve my problem. But it seens 
> that OSG 2.0 FBOViewport does not have this method anymore. And all the 
> other posts i had read about this were using OSG 1.x, so i got a little 
> confusing.

the FBOViewport is only in 2.0 for backward compatibility, if you are 
developing a new application I'd recommend not to use it. Redirecting 
rendering output to FBOs is now done with the Stage (and derived types, 
which have a render target of type FrameBufferAttachment) - there are 
examples for how to use them in Source/System/NodeCores/Groups/Stage and 
Examples/Simple/fbotexture.cpp.
To get the texture read back to main memory, you need to:

fbo->setPostProcessOnDeactivate(true);

and

texBuf->setReadBack(true);

where fbo is the FrameBufferObject your Stage renders into and texBuf is 
the TextureBuffer attached to the FBO.

That aside, it should not be too hard to support 
FBOViewport::setReadBuffer() for compatibility.

        Cheers,
                Carsten

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to