Hi George,
Can I also assume that after viewer::frame() returns, it is guaranteed that no
OSG threads related to rendering or scene traversal are running?
Rendering : no you can't assume this.
Scene traversal : yes you can assume this.
The explanation:
In some multithreading modes (see
osgViewer::ViewerBase::setThreadingModel) frame() will return when the
DYNAMIC drawables / state have been dispatched. So if you're modifying
drawables / state in the update phase (before calling frame() or in an
update callback) you need to mark those as DYNAMIC (see
osg::Object::setDataVariance). osgText::Text objects are perfect
examples of this - if you modify one such object by calling setText() on
it, you need to mark it as DYNAMIC.
However, at that point (between calls to frame()), the graph structure
is not needed anymore by the draw threads, so you're free to modify the
structure as you want. Just make sure, if you modify the graph structure
in the update traversal, that you only do it for your children,
otherwise you'll be invalidating iterators and will get crashes.
Can I ask what is the use of viewer::start/stopThreading() then?
Things that affect the draw traversals sometimes need draw threads to be
stopped completely. Things like adding views to a CompositeViewer, or
changing the graphics context on a camera, or things like that. It's
pretty rare you need to do this. It's also pretty costly, because
stopThreading() will only return once the draw threads have been stopped
and deleted, and startThreading() only returns once new draw threads
have been created and started.
Hope this helps,
J-S
--
______________________________________________________
Jean-Sébastien 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