[osg-users] Executing code before gl context is closed when viewer is shutdown

Robert Osfield robert.osfield at gmail.com
Tue Aug 18 02:50:18 PDT 2015

Hi Bjorn,

I can't think of any callback or similar class similar to the
RealizeOperation().  It would be straight forward to add but this would
only help things for a future rev of the OSG.

Perhaps you might be able to use a osg::Camera::FinalDrawCallback that is
only enabled on the last frame(), but this would need one to signal that
it's that last frame...

Failing these approaches you could build the viewer so once you exit the
frame loop you stop threading, make the context in question current and
then call what you need to do and then let the viewer destruct all the


On 18 August 2015 at 10:21, Björn Blissing <bjorn.blissing at vti.se> wrote:

> Hi,
> More odd questions connected to my Oculus integration.
> Is there a simple way to detect when the osg::viewer is ordered to close?
> I need to execute some Oculus related code before the OpenGL context is
> closed. So what I am looking for is some form of opposite of
> viewerBase.setRealizeOperation() function.
> My first idea was to subclass the osg::GraphicContext class and run my own
> custom destructor before the default constructor. But that idea is a no go,
> because the OS dependent windowing APIs are already implemented as
> subclasses to osg::GraphicContext.
> Best regards
> Björn
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=64814#64814
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150818/f5d87228/attachment-0003.htm>

More information about the osg-users mailing list