[osg-users] The importance of using Camera::setDrawBuffer()+setReadBuffer() in application setup

Julien Valentin julienvalentin51 at gmail.com
Fri Mar 9 21:10:16 PST 2018

I haven't followed recent developpement this last 15 days but after merging my fork with master todya, all my rtt stuff saved as osgb doesn't work anymore(freeze).
You said using using osgviewer would be okay but it doesn't seams to work 
I had setted all my view and rtt cam Read/Draw buffer to GL_BACK but nothing help...
Any idea why?

robertosfield wrote:
> Hi All,
> A recent investigation into a bug a user was seeing in their
> application revealed that some applications that use 3rd party
> windowing toolkits aren't setting up the viewer Camera's correctly,
> and I've traced this back to the examples that the OSG provides.  To
> fix these I checked in the followinig commit that patches the various
> osgviewer* examples:
> https://github.com/openscenegraph/OpenSceneGraph/commit/ee3e8202779f370501a1a27c83cb9a72ad009439
> These fixes are now checked into the OpenSceneGraph-3.4 branch and
> master.  The changes are all in form:
> // set the draw and read buffers up for a double buffered
> window with rendering going to back buffer
> camera->setDrawBuffer(GL_BACK);
> camera->setReadBuffer(GL_BACK);
> This explicitly tells the OSG that you wish it to render to the back
> buffer, rather than just leave it to OpenGL defaults.  Not having
> these calls causes problems when you do RTT work where the draw/read
> buffer state has to be toggled between different states.  You can
> think this of a classic uninitialized variable issue - if you don't
> set the value you can get undefined results.
> If you are using native osgViewer windowing it's likely that you won't
> need to make any changes as the code in osgViewer for setting up
> various viewer configurations do the neccessary
> setDrawBuffer+setReadBuffer() calls.  If you are are creating the
> graphics context and setting up the Camera's yourself then you'll need
> to above calls.
> If you are using a Pixel Buffer then you'd set the values to GL_FRONT,
> or if you are using stereo buffer then you'll won't to use
> Cheers,
> Robert.
> _______________________________________________
> osg-users mailing list
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>  ------------------
> Post generated by Mail2Forum

Read this topic online here:

More information about the osg-users mailing list