Hi Randall,

On 5 September 2012 02:05, Randall Hand <randall.h...@gmail.com> wrote:
> I've been programming in OpenGL for several years now, and I'm about to start 
> a new project and thought OpenSG might be a good tool to use.  However, I'm 
> integrating data from lots of outside sources (gyros, cameras, network, etc) 
> so I can't just do a "Viewer run()" (looking at doing the Viewer frame() 
> thing), but I'm also going to have lots of frequently changing geometry & 
> camera information.  All the demos I see simply construct a Scenegraph once 
> at program start, then do "Viewer run()".  Is it possible/advisable to have 
> frequently changing scenegraphs with OpenSG (eg, new nodes, dying nodes, 
> changing nodes, etc).

Wow, it's been quite a while since anyone got confused between OpenSG
and OpenSceneGraph, must be near a decade since the OpenSceneGraph
came out top in the battle of the most widely used open source scene
graphs...

As to answer your question, how to you modify OSG objects... well most
OSG application need to do just what you are doing, and either use
update, event, cull or draw callbacks, or add event handlers and
camera manipulators to the viewer, or simply provide updates via the
the viewer main loop.  The examples mostly use Viewer::run() but not
all, and Viewer::run() is really just a convenience method for writing
simply applications.  If you have a look at the actual Viewer::run()
implementation found in OpenSceneGraph/src/osgViewer/Viewer.cpp you'll
see a slightly more complicated version of:

viewer.realize();
while(!viewer.done())
{
    viewer.advance();
    viewer.eventTraversal();
    viewer.updateTraversal();
    viewer.renderingTraversals();
 }

You splice your own code in your frame loop.  You can even subclass
from Viewer/CompositeViewer and override all of these
eventTraversal(), updateTraversal() and renderingTraversals() methods.

In short there are dozens of different ways you can update you scene
graph, what is most appropriate will depend entirely down to your
applications needs.

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

Reply via email to