Hi Dat, I recommend you to peruse the "osgkeyboard.cpp" file that comes with the source code examples (specifically the classes "KeyboardEventHandler" and "osgGA::GUIEventHandler"), and to upgrade to a more recent OSG version (at least 2.6.0).
Regards, Alberto El Miércoles 21 Enero 2009ES 06:34:45 tien dat escribió: > Dear all, > I have a very basic question of how to capture key pressed event in > OpenSceneGraph. > My program is set up like this: > > osgProducer::Viewer *viewer = new osgProducer::Viewer(); > //some more initialization here > Producer::KeyboardMouse* km = viewer->getKeyboardMouse(); > Producer::RenderSurface* rendersurf = km->getRenderSurface(); > if(rendersurf ==NULL) > { > exit(-1); > } > viewer->realize(); > while( !viewer->done() ) > { > > // wait for all cull and draw threads to complete. > viewer->sync(); > > // update the scene by traversing it with the the update > visitor which will > // call all node update callbacks and animations. > > viewer->display(); > > // fire off the cull and draw traversals of the scene. > viewer->frame(); > > } > > But I don't know how to capture a key that users pressed to trigger > another event. Could any of you give me a hand. > Thank you, > Dat _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org