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 <[email protected]>:
>
> 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
>
>
>
>
>
> _______________________________________________
> 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