PDA

View Full Version : simple mouse position question



aetebari
01-07-2002, 08:55 AM
I am having trouble determining the position of the mouse cursor on my openGL window. All I need is the x and y coordinates. Could somebody please help me with what function to use, and how it is implimented?

Thanks!

Ali

mikael_aronsson
01-07-2002, 10:35 PM
Hi !

Gettings the mouse position has nothing to do with OpenGL so you need to be a bit more specific about what you are using (Win32/MFC/GLUT/SDL...),

Most of the time you get the mouse position in the event messages, but if you need the cursor position outside that you can use the win32 function GetCursorPos() to get the cursor position in screen coordinates, then you use ScreenToClient() to convert it to window coordinates.

In the case of GLUT there is a good topic on this in the manual.

Mikael

aetebari
01-08-2002, 06:31 AM
Thanks! That helps a lot!