simple mouse position question

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?



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.


Thanks! That helps a lot!