Guy Volckaert wrote:
Hi,
I'm little confused about when it's appropriate or even necessary to call setDataVariance(DYNAMIC) - assuming we are not running in SingleThreaded mode.
You should read through the archives, as this has been discussed quite a
bit. In summary, DYNAMIC keeps things thread-safe in osgViewer
multithreaded modes, and keeps the Optimizer from optimizing away your
nodes.
1) If I have a switch node and want to change its state in the update or event
sequence (i.e during runtime), does the data variance need to be DYNAMIC?
No. Switch nodes aren't part of the render graph, they're processed
during cull. This means you can alter the Switch during event/update and
rest assured that no draw thread is trying to access your Switch.
2) If I add a child node to a simple Group node (again during runtime), does the Group node need to be DYNAMIC?
Same as for Switch.
3) If I have a my target has a MatrixTranform node and I decide to update its matrix, does it need to be DYNAMIC?
I don't think so, because if I remember correctly the CullVisitor stores
only the accumulated transformation in the render graph, which means
that after cull is complete, draw never references the MatrixTransform
and you're free to change it. You should look at the CullVisitor code to
be sure.
In all three of these cases, you might want set the DataVariance to
DYNAMIC anyway, or at least add a comment saying it's not necessary and
why. This might make it easier for future developers maintaining your code.
-Paul
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org