elekis wrote:
[snip]
     > //init
     > osg::Group* root = new osg::Group();
     > osg::Group* root2 = new osg::Group();
     > viewer.setSceneData( root );
     >
     > // after a action
     > viewer.setSceneData( root2 );
     >
     > // after a other action
     > viewer.setSceneData( root );
     >
     > I trying that, but that doesn't work.  (root 2 is accepted but core
     > dumped just after)
     >
     >
     > is it possible to do that??

    Others have told you the "better way" to do this but in case you were
    curious why it crashes the way you've done it, I'm pretty sure it's
    because you aren't using ref_ptr's.  Once you set root2 then root is
    removed from the scene and the reference count goes to zero.  This means
    it is deleted.

No, I use  ref_ptr, here was just an example . thanks,
a++

Ok. Just that with the code as you have above it would definitely crash exactly like you describe. If you use ref_ptr's instead then it shouldn't.

-Paul
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to