Question

I know that I can use a Mouse callback function for when a user clicks the mouse, but what if I want to know the current x/y position without the user clicking?

Will I have to use a different callback that gets called on any mouse movement and keep track of the x/y myself or is there a function I can call within GLUT/OpenGL to get it?

Was it helpful?

Solution

Register a glutPassiveMotionFunc callback function

See info about callbacks

OTHER TIPS

You need to use the glutMotionFunc/glutPassiveMotionFunc callback to track mouse movement independent of mouse clicks.

7.6 glutMotionFunc, glutPassiveMotionFunc

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top