J-S,

Yes, a great point I failed to bring up about the mutex. Thanks for mentioning 
that. We did have to do that to protect the shared resource when we used 
threading. 

For our stuff, one process (out-the-window) does the usual traversal (via 
viewer.frame) while the other sits idle until a request comes in for either 
HAT/HOT or LOS. Once a request comes in, it just computes the intersection with 
the terrain via the osgSim class and sends the scalar result back. Both 
processes load the same PagedLOD terrain node but they're using completely 
different graphs. We only check for intersection with terrain and nothing 
else...

-Shayne

-----Original Message-----
From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Jean-Sébastien 
Guay
Sent: Thursday, May 12, 2011 2:37 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Intersection testing in a separate thread

Hi Shayne, Craig,

> Bottom line is that it can be done. It basically amounts to having 
> asynchronous traversal of the same scenegraph, one for rendering traversal 
> and the other for intersections. These traversals can either be done in 
> different threads or different processes.

But the case of a different thread vs a different process is not the 
same. In his case, there will be (optimally) one copy of the scene 
graph, and both the rendering and the intersection thread will access 
it. He will need a mutex which would be held by the rendering thread 
while it's in the update phase, and by the intersection thread while it 
does an intersection. In your case, you have two copies of the scene 
graph, so there are no threading issues. (how did you update the scene 
graph between processes?)

But that doesn't mean it can't be done, just that it's not quite as 
simple as that.

Hope this helps,

J-S
-- 
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                                http://www.cm-labs.com/
                     http://whitestar02.dyndns-web.com/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to