Hello, Robert
Sorry for the late response. But I still cannot figure out why the
thread calling "viewNode->accept(IntersectionVisitor)" just stops there
without going any further. I took a look at the source code of
"accept()" function as well as the "frame()" function of viewer, but I
didn't find a mutex or something like that to protect the node from
being visited by two nodevisitors at the same time. In my application,
intersectionVisitor will not change the scene data, only to get
intersections. I try to do this because I need the intersectionVisitor
to change matrix and perform intersection at a higher frequency than the
main frame frequency of the scenedata traversal. Is there any
possibility to work this out?
Thank you very much in advance!
Best regards
Shuiying
On 04/01/2012 09:05 PM, [email protected] wrote:
Message: 11
Date: Sun, 1 Apr 2012 18:44:28 +0100
From: Robert Osfield<[email protected]>
To: OpenSceneGraph Users<[email protected]>
Subject: Re: [osg-users] Help: intersectionVisitor in a separate
working thread cannot work when it is to visit a view node
Message-ID:
<cafn7y+xyjhv90c26hcrng9avdkh0gdujyuo9k6+oh+jjobj...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Hi Shuiying,
It's not safe to read for a data structure that is written to be
another thread. If you scene graph is not changing then it'll be safe
to traverse multi-threaded without problem but if it's changing you'll
need to serialize the reading from the writing threads in some manner.
The normal frame loop that the OSG provides with the update and event
traversal that can do updates occurring single threaded and before the
cull and draw traversals start.
Robert.
On 1 April 2012 09:46, wang shuiying<[email protected]> wrote:
> Hello,
>
> In my programme, I have among others a view node and a thread. The
> geometries under the view node changes every frame. The thread controls the
> frequency at which an IntersectionVisitor visits the view node.
>
> However it turns out it doesn't work. When the intersectionVisitor is ready
> to visit the view node, it stops there, without going further.
>
> If ?the visit of intersectionVisitor is made to be a part of ?the
> updatecallback of view node, then it works.
>
> I wonder if the intersectionVisitor can work separately from the
> updatecallback of the node that it visits
>
>
> Thank you very much in advance for any advice!
>
> Shuiying
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org