HI Shuiying,

The OSG doesn't have an IntersectorVisitor, but does have a modern
IntersectionVisitor and a long deprecated and less flexible
IntersectVisitor, if you are using the later I'd recommend using the
more modern IntersectionVisitor.

As for threading, visitors are written to be used single threaded, and
when you want to run multiple traversals at the same time the
appropriate technique is to create one visitor per thread.  In cases
like InteresectionVisitor they are pretty light weight so can be
created and used on the the fly - there shouldn't be a need to store
one per application.  Creating the visitor on demand in the thread
that needs it avoids any threading issues.

Robert.

On 22 February 2012 21:32, wang shuiying <shuiying.w...@fu-berlin.de> wrote:
>
> Hello,
>
> My program has an osg::viewer as a view widget of a Qt window. An
> intersectorVisitor object  is initialised at the start of the program.  The
> osg::viewer updates its children nodes  as a normal viewer does, and updates
> the transform matrix of intersectorVisitor at the same time. I make another
> thread to do call of "node->accept(intersectorVisitor)", where the node is
> the root node of osg::viewer. In case that the two processes might conflict
> with each other I set lock with Qmutex when the osg::viewer updates and when
>  "node->accept(intersectorVisitor)" is called in another thread.  But the
> result turns out to be wrong. When I let the two processes run freely
> without locking them, then the result is right.
>
> I am wondering what happens here. That is to say, what intersectorVositor
> will do when it itself is locked or the nodes that it visits are locked.
>
> Thank you very much in advance!
>
> Shuiying
>
>
> _______________________________________________
> 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