Hi Robert,

   I use two way to modify my scene graph. 

   The first one is using the UpdateCallback each time it is possible. 
   The second one is when we are outside the ViewerBase::frame() function.
   Our application have a lot of threads and i use a mutex to be sure the OSG 
tree is never access in the same time by two or more threads.

    The code like this:

   mRenderingTreeMutex.lock
   mViewer->frame()
   mRenderingTreeMutex.Unlock

   And each time i touch the OSG tree, i use the same mutex.

   mRenderingTreeMutex.lock
   Modifiying OSG tree
   mRenderingTreeMutex.Unlock

   So in my case i call the Viewer::setLightingMode between my 
mRenderingTreeMutex and the function modify the internal variable 
_lightingMode. According to the debugger, this variable is process during the 
cull_draw that is made by all camera's thread in the same time.

   So, during one thread call the _globalStateSet->removeMode(GL_LIGHTING) 
function, another one use the _globalStateSet variable and this variable is the 
same for all threads that cause the crash.

   Everything append in the void SceneView::setLightingMode(LightingMode mode) 
function.

   To temporary solve my problem, i add a mutex to protect the access to the 
_globalStateSet variable.

   Maybe this variable can be process in the update instead of the cull/draw?

Thank you!

Cheers,
Sylvain

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=59099#59099





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to