[osg-users] Read frame buffer back into main memory

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Thu Mar 1 00:53:53 PST 2018


Hi Antoine,

set a postDrawCallback to the pass/camera that writes to the texture.


In the callback:

virtual void operator () (osg::RenderInfo& render_info) const
     {
     osg::State* state=render_info.getState();
     state->apply(render_info.getCurrentCamera()->getStateSet());
     state->applyTextureAttribute(0, mTexture);
     mTexture->apply(*state);
 
mImage->readImageFromCurrentTexture(render_info.getContextID(),true, 
GL_FLOAT ); //change the GL_FLOAT to your needs
     }

the mTexture is passed to the callback using the original texture 
attached to the MRT.



Cheers
Sebastian

Am 28/02/2018 um 19:05 schrieb Antoine Rennuit:
> Hi all,
> 
> I need to read the frame buffer back into the main memory. I know this will kill performance but I only need to do it once.
> 
> Is there a way to do that? I could not find clear answers on the internet.
> 
> Thanks,
> 
> Antoine.
> 
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=72990#72990
> 
> 
> 
> 
> 
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 


More information about the osg-users mailing list