You can also workaround this (instead of using the eventqueue) by telling OSG about the input range of your mouse after setting up your viewer:
viewer->getEventQueue()->setMouseInputRange(x, y, x + width, y + height); Cheers, Martin 2014-05-05 13:12 GMT+02:00 Wouter Roos <[email protected]>: > > wroos wrote: > > Good day, > > > > I'm working on an Android OSG program and I've recently upgraded from > OSG 3.0.1 to OSG 3.3.1. The viewer seems to work correctly, I do see the > objects I load, but as soon as I give a touch input the model goes out of > view. In the second navigation mode the model starts spinning extremely > fast, even with the smallest touch input. Previously, in version 3.0.1, > this worked fine for me. Is there something changed in the later osg > versions and does the osg AndroidExample needs to be updated or is there > something else I'm missing? > > It looks like it needs normalized inputs rather than absolute pixels > values, but I got stuck implementing that for picking objects, which I > can't get back to work. > > > > Wouter > > > I solved the problem by using the EventQueue from the window(s) rather > than the viewer's, now everything works as expected. > Please see attached updated viewer code for osgAndroidExampleGLES2, will > work the same for osgAndroidExampleGLES1 > > > > > Code: > void OsgMainApp::mouseButtonPressEvent(float x,float y,int button){ > osgViewer::ViewerBase::Windows windows; > _viewer->getWindows( windows ); > for(osgViewer::Viewer::Windows::iterator itr = windows.begin();itr > != windows.end();++itr) > { > (*itr)->getEventQueue()->mouseButtonPress(x, y, button); > } > } > void OsgMainApp::mouseButtonReleaseEvent(float x,float y,int button){ > osgViewer::ViewerBase::Windows windows; > _viewer->getWindows( windows ); > for(osgViewer::Viewer::Windows::iterator itr = windows.begin();itr > != windows.end();++itr) > { > (*itr)->getEventQueue()->mouseButtonRelease(x, y, button); > } > } > void OsgMainApp::mouseMoveEvent(float x,float y){ > osgViewer::ViewerBase::Windows windows; > _viewer->getWindows( windows ); > for(osgViewer::Viewer::Windows::iterator itr = windows.begin();itr > != windows.end();++itr) > { > (*itr)->getEventQueue()->mouseMotion(x, y); > } > } > void OsgMainApp::keyboardDown(int key){ > osgViewer::ViewerBase::Windows windows; > _viewer->getWindows( windows ); > for(osgViewer::Viewer::Windows::iterator itr = windows.begin();itr > != windows.end();++itr) > { > (*itr)->getEventQueue()->keyPress(key); > } > } > void OsgMainApp::keyboardUp(int key){ > osgViewer::ViewerBase::Windows windows; > _viewer->getWindows( windows ); > for(osgViewer::Viewer::Windows::iterator itr = windows.begin();itr > != windows.end();++itr) > { > (*itr)->getEventQueue()->keyRelease(key); > } > } > > > [/code] > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=59256#59256 > > > > > Attachments: > http://forum.openscenegraph.org//files/osgmainapp_296.cpp > > > _______________________________________________ > 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

