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
osgWidget does this, and converts the origin to the upper-left instead
of lower-left in the WindowManager object just using getX/getY. They
have never returned normalized coordinates in my usage... but perhaps
I've been benefiting from a bug all along...?
On Thu, 2008-04-24 at 13:56 +, Andrew
How about:
float fMouseX = ((ea.getX() + 1.0)*0.5) * (float)ea.getWindowWidth();
float fMouseY = ((ea.getY() + 1.0)*0.5) * (float)ea.getWindowHeight();
- Donny
On Thu, Apr 24, 2008 at 8:56 AM, Andrew Lett [EMAIL PROTECTED] wrote:
In OSG2.2 I'd like to find the 'real' x,y location of the
Hello Donald,
I actually tried something along the lines of what you wrote:
int my_x = (int) ( ((ea.getX() + 1.0) / 2.0) * 640.0 );
int my_y = 480 - (int)(((ea.getY() + 1.0) / 2.0) * 480.0);
Your lines basically do the same thing (except flip the y axis). However, my
problem is that the
Jeremy Moles [EMAIL PROTECTED] writes:
Again, I never get the normalized values in osgWidget (and haven't since
I began writing it). This has to have something to do with the kind of
camera the event appears within, as looking through the code I see that
the event{X,Y} values are calculated
I found a workaround to my problems, my thanks to Jeremy for pointing a few
things out.
If I make the following setting:
camera-setAllowEventFocus(false);
Then in Viewer::eventTraversal() this will avoid setCameraWithFocus(camera);
code.
As to the reasoning of why there is separate
6 matches
Mail list logo