OpenGL Mouse-Coordinates...

Is there a function in OpenGL to retrieve the mouse-coordinates? I am asking because I want to have my app 100% portable, and that means not using the Win32 API any more than I have to. I was hoping there’d be some kind of function that would retrieve the coordinates using whatever API the app is compiled on.

If not, I have another idea on how to code it myself. I assume WINDOWS is defined automatically by the compiler for a Win32 app, and LINUX is defined for Linux/X-Win apps? If that’s the case, I can easily code my own function.

OpenGL ONLY provides a graphics api

so to answer your question, opengl does not have any mouse function calls.

but don’t despair - what you’re looking for [cross-platformability] is provided with glut, one of several cross-platform libraries to give your opengl apps access to non-graphics resources.

here’s a google search for glut and mouse. also, check (@ note to glut) for examples.

I hope that helps


GlUT functions provide windows and keyboard/mouse support. I strongly suggest you to visit this: