[osg-users] releaseGLObjects and shared contexts

Nathan Monteleone nathan.monteleone at lmco.com
Wed Nov 4 08:18:50 PST 2009

I have an application with two windows, one of which can be added and removed dynamically.  They use a shared GL context (i.e. I set the sharedContext flag in the graphics context traits) so that I don't need to keep two copies of my enormous textures.

I'm having a problem when I try to close one of the windows.  When the underlying graphics context closes, it makes a call to releaseGLObjects on the associated camera and cleans up all the objects associated with my scene...  But since the context was shared, it's deleting objects out from under my first view.

I had some success with a workaround -- just remove the scene data from my second view before closing it.  That way only the gl objects associated with the camera itself get released, nothing else.

Has anyone else run into this?  Maybe I could write a fix to OSG by checking the context ID usage count before calling releaseGLObjects?

Read this topic online here:

More information about the osg-users mailing list