In OSG2.2 I'd like to find the 'real' x,y location of the mouse cursor. If my
window is 640x480, then the value for x should be between 0 and 639, while y
should be from 0 to 479. I need the x,y values in this form so that it can be
injected into CEGUI correctly.

The GUIEventAdapter has protected members _mx and _my, along with the access
methods getX() and getY(). However, these methods both yield values between -1
and 1. While stepping through the code, the _mx and _my actually correctly hold
the pixel based values I need until encountering the following section in
Viewer.cpp:

   osg::Vec3d new_coord = osg::Vec3d(x,y,0.0) * matrix;
   x = new_coord.x();
   y = new_coord.y();                                
   ...
   event->setX(x);
   event->setY(y);

Aside from making private changes on GUIEventAdapter, is there any other way to
read the mouse x,y location in the format I need?

All suggestions are very much appreciated.

Sincerely,
- Andrew


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

Reply via email to