HI Konstantin,

On 28 August 2014 09:06, Konstantin <[email protected]> wrote:

> Can I call setCullMask for viewer's camera from the other thread while
> viewer is running?
>

There isn't any mutex around the set/get of a the Camera::CullMask, but it
is just a unsigned int so as long as the camera isn't deleted by one the
threads all the threads we will contending over will be the value of the
CullMask.  All the CullMask affects is the traversal - if it's wrong then
you'd see the wrong parts of the scene graph traversed and this could be in
an inconherent way - for instance half the cull traversal might use one
mask and the other half use the new value that was set by the other
thread.  This is the worst that can happen though, you won't get a crash.

The completely safe and reasonable way to set things like the
Camera::CullMask is in the update phase of the frame.  Cueing up Operation
objects to do the operations on the scene graph in a thread safe container
is one way of managing this - the Viewer has the OperationQueue for just
this purpose - just add an operation via
viewer.addUpdateOperation(operation) and it'll be called automatically for
you, you just need to subclass from Operation and get it to do the dirty
work for you.

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

Reply via email to