Hi James, >From your email It isn't at all clear what you are doing, why you are doing it, let alone what you are doing wrong.
It's very odd that you are trying to add a node as a event handler to the viewer. The OSG has an event traversal that will ensure your node gets events. Please have a look at the examples, and do a search for EventCallback. Also please try and upgrade to 2.8.2, the OSG has improved alot since 2.2. Robert. On Thu, Aug 20, 2009 at 5:01 AM, James Sim<[email protected]> wrote: > Hi, > > I have a class called A that inherits osgGA::GUIEventHandler and osg::Switch. > I passed in the viewer from the main class to class A through class A's > constructor. > > In class A's constructor, i add the eventhandler to itself through the viewer. > > The problem occurs when i try to remove the children through the main class. > > What should be the proper way to do it? > > class A : public osg::Switch, osgGA::GUIEventHandler > { > A (osgViewer::Viewer * viewer) > { > viewer->addEventHandler(this) > } > } > > class MAIN > { > osgViewer viewer * viewer = new osgViewer(); > A a = new A(viewer); > osg::Group * mainGroup = new osg::Group(); > mainGroup->addChild(a); > viewer->setSceneData(mainGroup); > > mainGroup->removeChild(0, mainGroup->getNumChild()-1); > } > > Thank you! > > Cheers, > James > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=16450#16450 > > > > > > _______________________________________________ > 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

