[osg-users] Problematic call of flushDeletedGLObjects

Robert Osfield robert.osfield at gmail.com
Mon Sep 26 08:46:29 PDT 2016

Hi Valerian,

On 26 September 2016 at 16:27, Valerian Merkling <niarkoleptik at gmail.com> wrote:
> I didn't managed to get a running example, but working on it made me find a solution.
> It seems that I need to use the releaseGLObjects functions on nodes that I totally remove from the scene graph.
> With that call, my shaders are flagged for destruction AND destroyed when closing the view => everythings seems to be ok now !

Great to hear you've sorted the problem.  The OSG does try to manage
the GL objects during open/closing of contexts but alas if you remove
a subgraph from the sight of the viewer it then will not know that
there are objects that need to be cleaned up there.  For these as you
have found you'll need to call releaseGLObjects() prior to closing the
garphics context.

If you attempt the GL object clean up after the graphics context has
been closed then you'll need to call subgraph->releaseGLObjects() then
call osg::discardAllGLObjects(contextID) for the context.


More information about the osg-users mailing list