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)
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > 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=59270#59270





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to