On Tue, Feb 17, 2009 at 9:29 AM, Fabian Aichele <[email protected]> wrote:
> The next two question that arise are: What is the correct "how" and "when"?
> First, can manipulators be attached to any kind of  "container" graph node
> (i. e. Group/Transform/Geode), or are there certain restrictions.

event handlers/event callback can be attached to any Node or to the
viewer/view.  All node callbacks are effectively traversal callbacks.

> Second, if I don't use viewer.run(), but a while loop that keeps calling
> viewer.frame(): Where is the right place to add manipulators, before or
> after requesting the next frame to be drawn?

Before or after is fine.  Or you can just split the frame() up into
it's constient parts.  Go have a look at the viewer.frame() to see
what it's composed of.

> And, what mutexes/semaphores do
> I have to lock/unlock to ensure that I don't break other operations on the
> scene graph (though I up to now thought that the scene graph is only
> manipulated by update/culling etc. traversals after a call to the frame()
> function).

update and cull are all syncronous so are fine to update in the main
loop from, the only part you need to watch is when using
DrawThreadPerContext and CullThreadPerCameraDrawThreadPerContext
threading models the draw traversal overlaps with the
update/event/cull traversals of the next frame.   Only Drawables and
StateSet are traversed by the draw traversal so you don't have to
worry about modify nodes, but you need to take care about modifying
Drawable and StateSet to avoid threading issues, the standard way to
do this is to set the DataVariance on them to DYNAMIC to tell the
renderingTraversals() method to hold back till all dynamic objects
have been processed.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to