Hey all,
I've been searching the forums this afternoon and can't seem to find the answer 
to my question. I have a viewer setup with the following:

rViewer = new osgViewer::Viewer();
        
wm = new osgWidget::WindowManager(rViewer, width, height, 
MASK_2D, osgWidget::WindowManager::PD_NONE);
        rViewer->setUpViewInWindow(width,height,wm->getWidth(),wm->getHeight());
cam = wm->createParentOrthoCamera();
        
osg::ClearNode *backdrop = new osg::ClearNode;
backdrop->setClearColor(osg::Vec4(0.1,0.1,0.0,1.0));
cam->addChild(backdrop);
        
// add event handlers
rViewer->addEventHandler(new osgWidget::MouseHandler(wm));
rViewer->addEventHandler(new osgWidget::KeyboardHandler(wm));
        
rViewer->realize();
rViewer->setCameraWithFocus(cam);
rViewer->setSceneData(cam);

And I need to be able to close the window dynamically. I implemented this:

osgViewer::Viewer::Windows windows;
rViewer->getWindows(windows);
osgViewer::GraphicsWindow *win = *windows.begin();
    win->getEventQueue()->keyPress(osgGA::GUIEventAdapter::KEY_Escape);
    win->getEventQueue()->keyRelease(osgGA::GUIEventAdapter::KEY_Escape);

but no joy. If anyone can point me in the right direction I'd be most grateful. 
Thanks in advance!

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=18198#18198





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to