Hi Joshua,

I'm wondering, have you tried just adding / removing nodes in your graph before calling frame() on your viewer?

The Draw traversal, which may still be running when the previous frame() returns, should theoretically not care about changes in the graph. That's because the cull traversal gathers statesets and drawables into its own lost, stored in ref_ptrs, and then the draw phase dispatches the draw calls for those based on the list gathered during cull.

But when frame() returns, cull is finished, and update for the next frame hasn't started yet, so it should be safe to modify the graph at that point. Any nodes you remove from the graph don't matter since draw has stored all the drawables and statesets (that it needs) in ref_ptrs. And no other traversals are running (draw is not technically a traversal, since it has its own list and doesn't traverse the graph), so no iterators will be invalidated by adding or removing children in your graph.

The DYNAMIC data variance only applies to drawables and statesets, for that same reason. It's those things that the draw traversal may be using at the same time as another thread, so it's those things that need to be dispatched before frame() returns.

The things that need special care are adding / removing views in a CompositeViewer, or replacing the graphics context on a camera, or things like that. For those, you'll generally have to stopThreading() before, then startThreading() after the operation, to make sure no draw threads are running when you do them.

But changing the graph can safely be done between calls to frame(), that shouldn't be a problem.

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                    http://whitestar02.dyndns-web.com/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to