Assuming your not already using reference pointers OSG uses reference counting to aid in memory clean up and all OSG nodes are derived from reference counted objects When you add a node to a parent or the scene its reference count increments when it is removed it is decremented, in your case its reference count hits zero so the node and its attached state and children will all be delete ( assuming your not using ref_ptr's ) see the OSG web site or my FAQ's at vis-sim.com for more info So basically you need to use reference pointer objects and not raw pointers to you OSG nodes e.g ref_ptr<osg::Group> m_root1 = new osgGroup; ref_ptr<osg::Group> m_root2 = new osgGroup; m_viewer.setSceneData( m_root1.get() );
__________________________________________________________ Gordon Tomlinson Email : [EMAIL PROTECTED] Website : www.vis-sim.com www.gordontomlinson.com __________________________________________________________ "Self defence is not a function of learning tricks but is a function of how quickly and intensely one can arouse one's instinct for survival" -Master Tambo Tetsura _____ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of maruti borker Sent: 28 December 2007 13:51 To: OpenSceneGraph Users Subject: [osg-users] Changing SceneData I have a single viewer , and two different root nodes ... When the program loads i initialize the viewer with the first root . Then on a keypress i change my viewer scene data to second root . And i also have a kepress by which the viewer should go back to earlier root ( i,e first root ) . The first keypress is working .. but the second key press is giving a segmentation fault ...On debuggin i found that the viewer.setSceneData(root1) is giving a seg fault. Any idea why this is happening ?? Cant we change hte sceneData in between ? -- ---------------------------------------------- Maruti Borker IIIT Hyderabad Website:- http://students.iiit.ac.in/~maruti Blog:- http://marutiborker.wordpress.com
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

