CompositeViewer support: Difference between revisions

Jump to navigation Jump to search
m
Line 334: Line 334:
checked. This means the nodes and any sate attributes attached to
checked. This means the nodes and any sate attributes attached to
StateSet are ignored.<ref>https://groups.google.com/g/osg-users/c/W4OFWPp9YJ8/m/poyUdg7_oBsJ</ref>
StateSet are ignored.<ref>https://groups.google.com/g/osg-users/c/W4OFWPp9YJ8/m/poyUdg7_oBsJ</ref>
First try, CullDrawThreadPerContext thread model to see if that works safely. If it does then the issue is almost certainly down to some StateSet or Drawable in your scene graph that you are modifying the contents that don't have the DataVariance set to DYNAMIC.<ref>https://groups.google.com/g/osg-users/c/jgS0PqLcvtI/m/qlPPWXTNpzIJ</ref>
ou only need to set the Node DataVariance as a hint to the osgUtil::Optimizer that is typically only used after loading a new model, the Node DataVariance is not used during the update, event, cull or draw traversals.
However, when using DrawThreadPerContext or CullThreadPerCameraDrawThreadPerContext threading models the StateSet and Drawable DataVariance is used to prevent dynamic leaves of the scene graph being updated and rendered at the same time - the draw traversal holds back the main thread till all the dynamic objects have been dispatched.<ref>https://groups.google.com/g/osg-users/c/nH-73NNFw4A/m/Y4Qfdu4-XAIJ</ref>
When running in DrawThreadPerContext or CullThreadPerCameraDrawThreadPerContext threading models, these threading models use the DataVariance of StateSet and Drawable to decide when it's safe to let the next frame advance.
It's only the contents of StateSet and Drawables that your need to mark as DYNAMIC if their contents are changing.  If only  their ownership is changing they you'd don't need to set them to DYNAMIC, even if you remove the StateSet or Drawable from the scene graph it's still safe as the rendering back end takes a reference to StateSet and Drawables that it's about to render.
Node do not need to be set to DYNAMIC for the purposes of update, event, cull and draw traveresals.  The only part of the OSG that checks the DataVariance of Nodes is the osgUtil::Optimizer.  <ref>https://groups.google.com/g/osg-users/c/YMl1VfweIxQ/m/JGTB3hOlqDIJ</ref>
Changing the scene graph during event traversal shouldn't be a problem
and shouldn't require you do set the Drawable and StateSet to DYNAMIC
unless you are modifying the contents of these objects. The only area
that might be worth looking at is if the draw traversal is access the
parent lists of the Drawable and/or StateSet while these are being
modified by the event traversal.<ref>https://groups.google.com/g/osg-users/c/lDoIMXxIH7U/m/wUi-g79Zn3cJ</ref>
=== Data Variance ===
=== Data Variance ===


Navigation menu