On 11/01/2011 12:17 PM, Thomas Lerman wrote:
Yeah, I have been looking at the source code quite a bit lately trying to get 
these things to work. I am not really sure what your are saying about the 
following method:
Code:
int Viewer::run()
{
     if (!getCameraManipulator()&&  getCamera()->getAllowEventFocus())
     {
         setCameraManipulator(new osgGA::TrackballManipulator());
     }

     setReleaseContextAtEndOfFrameHint(false);

     return ViewerBase::run();
}


The last line is the key. Viewer::run() calls ViewerBase::run(). If you look at ViewerBase::run(), you'll see that it calls ViewerBase::frame() in a while (!_done) loop (along with some other ancillary stuff to handle on-demand rendering, run-to-frame control, etc). So, you could, in fact, write your own run loop like this:

while (!viewer.done())
{
   viewer.frame();
}


If you need more control than that (which it sounds like you do), you can look at ViewerBase::frame(). ViewerBase::frame() couldn't really be much simpler. Essentially, it is just:

advance();
eventTraversal();
updateTraversal();
renderingTraversals();

You probably don't need to mess with the advance() step, or the renderingTraversals() call, so you can just look into the event and update passes to see where you might need to make some adjustments. Hopefully, this will help get you going in the right direction.

--"J"

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to