Hi Paul,

I think there is a better way to set your own visitor, maybe doing:

osgUtil::CullVisitor::prototype()=new MyVisitor();

if you do this before realize() (or run()), then the viewer uses the
prototype of the cull visitor.

Rafa.


On Tue, Nov 10, 2009 at 3:23 PM,  <[email protected]> wrote:
> Thanks for the quick response...
>
> Did this:
>    render->getSceneView(0)->setCullVisitor(cv);
>    render->getSceneView(1)->setCullVisitor(cv);
>
> and now I'm getting:
> Warning:createOrReuseRenderLeaf() skipping multiply refrenced entry.
> Warning:createOrReuseRenderLeaf() skipping multiply refrenced entry.
> Warning:createOrReuseRenderLeaf() skipping multiply refrenced entry.
> Warning:createOrReuseRenderLeaf() skipping multiply refrenced entry.
>
> Paul P.
>
>
> ----- Original Message ----
> From: Jean-Sébastien Guay <[email protected]>
> To: OpenSceneGraph Users <[email protected]>
> Sent: Tue, November 10, 2009 8:57:38 AM
> Subject: Re: [osg-users] Setting CullVisitor
>
> Hi Paul,
>
>> Why do I have multiple SceneViews?
>
> There are always two SceneViews if you're using multithreading - they're used 
> on alternating frames as you've seen. Just set your CullVisitor for both, or 
> a separate instance of your CullVisitor for each instance.
>
> Whenever I've had to change something on SceneView instances, I had to do it 
> on both instances. I expect if your CullVisitor has some local state, you'd 
> have to use two separate instances, one for each SceneView, so that threading 
> works correctly and doesn't try to modify data that's being read in another 
> thread.
>
>> I need my own CullVisitor because I've defined my own node type that needs 
>> special cull handling.
>
> You could just override the traverse() method of your node type, that's how I 
> normally do it. It keeps changes local to the overridden node class instead 
> of propagating changes to other parts of the app.
>
>   void traverse(osg::NodeVisitor& nv)
>   {
>       if (nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR)
>       {
>           osgUtil::CullVisitor* cv =
>               dynamic_cast<osgUtil::CullVisitor*>(&nv);
>
>           // ...
>       }
>       osg::Node::traverse(nv);  // call base class version.
>       // (replace Node by whatever the base class of your overridden
>       //  node type is)
>   }
>
> Hope this helps,
>
> J-S
> -- ______________________________________________________
> Jean-Sebastien Guay    [email protected]
>                               http://www.cm-labs.com/
>                         http://whitestar02.webhop.org/
> _______________________________________________
> 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
>



-- 
Rafael Gaitán Linares
Instituto de Automática e Informática Industrial  http://www.ai2.upv.es
Ciudad Politécnica de la Innovación
Universidad Politécnica de Valencia
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to