<div dir="ltr">Hi Antonie,<div class="gmail_extra"><br><div class="gmail_quote">On 18 August 2017 at 22:25, Antoine Rennuit <span dir="ltr"><<a href="mailto:antoinerennuit@hotmail.com" target="_blank">antoinerennuit@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I understand the design difference you mentioni and it is relevant.<br>
<br>
Now from my readings of the beginners' guide, I understood that callbacks were needed to enforce thread safety. Your answer suggests that it is not the case. Can you confirm? i.e. do you confirm I can modify the OSG objects in a direct way (without callbacks) before calling Viewer::frame() and expect a correct rendering behavior?<br></blockquote><div><br></div><div>Using update callbacks assists with making scene graph updates thread safe but it's not a necessity, not even a guarantee.  It all depends upon the threading model you are using in viewer and when you are modifying what data.</div><div><br></div><div> If you are running the viewer SingleThreaded then the old threads that the OSG will create will be if you are using a paged database, in which case the OSG will automatically start background threads for reading the data.  These don't impact most work on applications as it all happening in background with data local to that paging threads and is only merged during the update traversal, the viewer handles this all safely for you.</div><div><br></div><div>If your are using CullDrawThreadPerContext you also don't need to worry about threading in the update phase (outside viewer.renderingTraversals() that's part of viewer.frame()) as all threads that are doing the rendering only run for the duration of the renderingTraversals() so you'll be safe modifying nodes and geometry/state outside of frame as well.</div><div><br></div><div>It's only in DrawThreadPerContext and CullThreadPerCameraDrawThreadPerContext threading models that you need to be careful about modifying the geometry/state in the scene graph as these elements of the scene graph may be read from in the draw thread that can still be running when renderingTraversals() finishes.  If you want to modify geometry/state you need to set the DataVariance on the geometry and state you are modifying to DYANMIC.  This applies to using callbacks or modifying the scene graph outwith viewer.frame().</div><div><br></div><div>You are free to modify nodes in the scene graph in the main loop/update and event traversals in all threading models.</div><div><br></div><div>Robert.</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div></div></div>