[osg-users] Recycling osgViewer Context IDs
Ross Anderson
ross at ll.mit.edu
Thu Jan 3 10:57:03 PST 2008
Hello,
I have a GUI application that recycles ContextIDs. After recently
porting the app to use osgViewer in place of SceneView I have a puzzling
issue that involves internal caching of texture objects. I have a
Texture2D instance shared between two or more contexts in different
windows. If one of the contexts is closed and a new one opened in it's
place (using the same context ID), the texture is no longer valid in the
new context (objects appear white and the OpenGL error 'invalid
operation' appears in the console). Using an OpenGL debugger indicates
that the error occurs in osg::Texture::applyTexImage2D_subload when
glTexSubImage2D is called.
I can work around the problem by explicitly calling dirtyTextureObject()
on every texture every time a context is being closed down, but I would
imagine there is a better way since this is quite messy. I have tried a
suggestion made in a previous thread which is to call this upon context
closure:
viewer->getSceneData()->releaseGLObjects( graphicsContext->getState() );
graphicsContext->getState()->reset();
osg::flushAllDeletedGLObjects(
graphicsContext->getState()->getContextID() );
Unfortunately this does not solve the problem. Any ideas?
---------------
Ross Anderson
ross at ll.mit.edu
Group 106 - Active Optical Systems
MIT Lincoln Laboratory
(781) 981-3344
More information about the osg-users
mailing list