[osg-users] Opinions: is OpenSceneGraph the right choice?
Hi, 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). ... Thank you! Cheers, Randall -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=49757#49757 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Opinions: is OpenSceneGraph the right choice?
Hi Randall, Randall Hand writes: Hi, 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. Be careful, OpenSG is a different project than OpenSceneGraph. 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). Yes, you can make your own loop through frame(). An example can be found at src/ViewerBase.cpp implementation of the run() method. You can change your graph between frame() calls, or use node callbacks for the same purpose. Just remember to mark changing nodes as DYNAMIC with setDataVariance() in order for the OSG threads not modifying/reading those nodes simultaneously. -- Alberto ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Opinions: is OpenSceneGraph the right choice?
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