View Full Version : simple mouse position question

01-07-2002, 07: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?



01-07-2002, 09: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.


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