I encountered some unexpected behavior when a Viewer is destroyed. When the viewer is destructing, it destroys its contained camera, which removes itself from its graphics context. During the removal process, the graphics context calls releaseGLObjects on the camera's children, passing in the GraphicsContext's _state member as a parameter. The problem is that at this point, the state has been already been reset to zero so that releaseGLObjects releases objects for ALL contextIDs. This will cause all objects that are used in multiple contexts to reload whenever a Viewer window is closed. This is potentially expensive and should be avoided if possible.

It appears that GraphicsContext::close already releases the GL objects from the relevant cameras so it may be that this call is redundant. Perhaps GraphicsContext::removeCamera can simply not call releaseGLObjects if it does not have a valid _state object. This fix seems to work for my code, but I'm using a modified version of osg that isn't dependent on cameras for cleanup of OpenGL resources.


Mark

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to