Hi Martin, I simply use
Code: osgUtil::LineSegmentIntersector::Intersections intersections; view->computeIntersections( ea.getX(), ea.getY(),intersections)); which is giving me correct results on Android and Windows, with using the EventQueue of the window(s) on Android. I was iirc getting the correct mouse ranges in Android, what version of osg are you using? I've tested with 3.3.1 Martin Siggel wrote: > Hi wouter, > I tried your code, but standard picking didn't work because the mouse input > ranges of the event are wrong. How did you do the picking? > Cheers, > Martin Am 06.05.2014 08:55 schrieb "Wouter Roos" < ()>: > > Thanks for that solution, that does make sense. I will be using my method > > of setting the EventQueue of the window as that requires no changes to my > > picker and I can keep my code base between desktop and Android the same > > apart for the viewer code. > > > > I suggest that for the examples we add the > > > > Code: > > viewer->getEventQueue()->setMouseInputRange(x, y, x + width, y + height); > > > > line to make the examples usable again. > > > > > > Martin Siggel wrote: > > > > > We also had that problem with the picker. We fixed that, by > > > reimplementing the picking like this: > > > > > > > > > // map pixel coordinates to [-1,1] (OpenGL Screen Coordinates) > > > float xwindow = x/screenWidth * 2. - 1; > > > float ywindow = -y/screenHeight * 2. + 1; > > > osg::Camera* cam = viewer->getCamera(); > > > osg::Matrixd m; > > > > > > m.preMult(cam->getProjectionMatrix()); > > > m.preMult(cam->getViewMatrix()); > > > // define intersection ray > > > osg::Vec3d startPoint (xwindow, ywindow, -1000); > > > osg::Vec3d endPoint(xwindow, ywindow, 1000); > > > osg::Matrixd i; > > > > > > i.invert(m); > > > osg::Vec3d wStart = startPoint * i; > > > osg::Vec3d wEnd = endPoint * i; > > > osg::ref_ptr<osgUtil::LineSegmentIntersector> picker = new > > > osgUtil::LineSegmentIntersector(wStart, wEnd); > > > > > > > > > > > > 2014-05-05 13:43 GMT+02:00 Wouter Roos < ()>: > > > > > > > > > > > > > > Martin Siggel wrote: > > > > > > > > > > > > > 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 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Thanks for that method, that looks much better, and works for the > > > > android examples just as well. > > > > However it does not work when I use a picker, it still returns no > > > > intersections whereas using the Window's EventQueue does give me the > > > > correct results. Any ideas on why this might be? > > > > > > > > ------------------ > > > > Read this topic online here: > > > > > > > > http://forum.openscenegraph.org/viewtopic.php?p=59259#59259 > > > > (http://forum.openscenegraph.org/viewtopic.php?p=59259#59259) > > > > (http://forum.openscenegraph.org/viewtopic.php?p=59259#59259 > > > > (http://forum.openscenegraph.org/viewtopic.php?p=59259#59259)) > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > osg-users mailing list > > > > () > > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)) > > > > > > > > > > > > > > > > > > > > > > > > > ------------------ > > > Post generated by Mail2Forum > > > > > [/code] > > > > ------------------ > > Read this topic online here: > > http://forum.openscenegraph.org/viewtopic.php?p=59270#59270 > > (http://forum.openscenegraph.org/viewtopic.php?p=59270#59270) > > > > > > > > > > > > _______________________________________________ > > osg-users mailing list > > () > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) > > > > > ------------------ > Post generated by Mail2Forum [/code] ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59283#59283 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org