<div dir="ltr">Hi Dario,<br><div class="gmail_extra"><br><div class="gmail_quote">On 12 April 2016 at 09:58, Dario Minieri <span dir="ltr"><<a href="mailto:paradox@cheapnet.it" target="_blank">paradox@cheapnet.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Simple question: set a uniform value via set() method is thread-safe or we have to set the value via Uniform callback? Apparently, set() works fine, but thread interactions are devious :D<br></blockquote><div><br></div><div>osg::Uniform::set() is not thread safe.  However, whether this is a problem for your usage model is not something I can say without more knowledge of your usage model.<br><br></div><div>Updating via an update callback doesn't add thread safety by itself.  If you are using DrawThreadPerContext or CullThreadPerCameraDrawThreadPerContext then the draw thread is allowed to run at the same time as the update, event and cull traversals of the next frame.  If you update the state or geometry in this case you need to to set the StateSet/Geometry DataVariance to DYNAMIC to prevent the draw thread from reading and the same time as it's being written.  This does however reduce the amount of the time the the draw thread can run in parallel with the update, event and cull traversals, in particular if the dynamic objects are in an opaque bin.<br><br></div><div>Robert.<br></div><div><br> </div></div></div></div>