elekis wrote:

hi all

I have a little probleme,

I have two node who represent two differents things,

and I would like to render one, and afer pushing a touch, changing on other

something like that
//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.

Something like:
osg::ref_ptr<osg::Group> root = new osg::Group();
osg::ref_ptr<osg::Group> root2 = new osg::Group();

...would have made the rest work since you would then be holding your own counted reference.

-Paul


other thing
I dunno if it's normal but
http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/classosgProducer_1_1Viewer.html

there are no getSceneData or my viewer is a osg::Producer


thanks a+++




------------------------------------------------------------------------

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

Reply via email to