HI Alex, On Wed, Feb 18, 2009 at 7:29 PM, Pecoraro, Alexander N <alexander.n.pecor...@lmco.com> wrote: > So when OSG_COMPIlE_CONTEXTS=ON then a background thread traverses the > scene graph and compiles the un-compiled display lists using a different > OpenGL context than the render thread's, which prevents the render > thread from having to do the display list compilation. Is that correct?
The compile context just sits with its own GraphicsThread waiting for GraphicsOperations to be passed to it, when they are other threads want their GL objects to be ran for them then simply create an appropriate GraphicsOperation and pass this to the compile Context's GraphicsThread. The DatabasePager does this with the following code: for(ActiveGraphicsContexts::iterator itr = _pager->_activeGraphicsContexts.begin(); itr != _pager->_activeGraphicsContexts.end(); ++itr) { osg::GraphicsContext* gc = osg::GraphicsContext::getCompileContext(*itr); if (gc) { osg::GraphicsThread* gt = gc->getGraphicsThread(); if (gt) { gt->add(new DatabasePager::CompileOperation(_pager)); } else { gc->makeCurrent(); _pager->compileAllGLObjects(*(gc->getState())); gc->releaseContext(); } } } Please note that all operations are pushed to the graphics thread of the compile context, the graphics thread itself does traverse anything, it's not an active class that does stuff on its own, it just sits their waiting for you to give it work and it does it, if it doesn't have anything to do it just goes to sleep. Robert. _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org