One of the items I have worked on today was the clean up of graphics
contexts and the scene graph associated OpenGL objects such as texture
objects and display lists.  When getting this to work on multiple
context apps I quite a few trying moments till I implemented a
relaseContext method in GraphicsWindow and suddenly everything started
behaving properly, a great relief as debugging multi-threaded,
multi-graphics context apps has a great ability to consume man hours.

The addition of bool GraphicsContext::releaseContextImplementation()
is also accompanied by the change for a void to bool return type for
the makeCurrentImplementation and makeContextCurrentImplementation()
methods.  These three methods all return true on success or false on
failure - as per glXMakeCurrent.

If you are working on a GraphicsWindow implementation of your own then
you'll also need to tweak the return types to keep things in sync.

Along with some automatic clean up code in GraphicsContext::close()
osgViewer based apps should now behave themselves when the
viewers/gaphics windows are repeatidly opened and closed - this is
something that has always been a hassel for users using SceneView or
osgProducer.  The following works a treat:

int main( int, char **)
{
   osg::ref_ptr<osg::Node> model = osgDB::readNodeFile("cow.osg");

   for(unsigned int i=0; i<5; ++i)
   {
       osgViewer::Viewer viewer;
       viewer.setSceneData(model.get());
       viewer.run();
   }

   return 0;
}


Cheers,
Robert.
_______________________________________________
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to