HI Guy, The osgViewer::Viewer/CompositeViewer run the GLObjectsVisitor vistor to compile GL objects on the first frame that the viewer runs, but if you add scene graph elements after this then you'll need to compile these. You can force the viewer to do another GLObjectsVisitor by getting the Renderer from the Camera(s) and setCompileOnNextDraw(true);. For a viewer with a single camera do:
osgViewer::Renderer* render = dynamic_cast<osgViewer::Renderer*>(viewer.getCamera()->getRenderer()); renderer->setCompileOnNextDraw(true); If you are incrementally add objects and wish to compile them bit by bit then then you can use the osgUtil::IncrementalCompileOperator that can be attached the viewer. This is a little more complicated to use though. Robert. On Sat, Feb 13, 2010 at 3:30 PM, Guy Volckaert <[email protected]> wrote: > I've bee experiencing momentary frame drops when I rotate my camera in my > scene. After look at the osg code, I noticed that many of the opengl objects > are created during runtime and not when the model is loaded. For example, > opengl texture objects are only created when the Texture2d::apply() is > traversed. A drawable display lists is only created when its > Drawable::drawImplementation() is called. > > I suspect that, in case, these runtime object creations are the cause of my > momentory frame drops. > > Is there a way to precreate all open objects located define in a scene graph? > That way I can confirm my suspicion. > > One way would be to have a VERY big camera frustum that encloses the entire > scene and then renders one frame, but that seems a little *hacked* to me. I > am trying to look for an alternative and better way to do that. > > Guy, > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=24117#24117 > > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

