View Full Version : glut: recieving mouse coords even when idle?
09-04-2001, 07:10 PM
It seems the mouse function in my glut program wont get the mouse coords unless the mouse is moving around so the program isn't idle. Is there a way to get it to always do it? The reason I want to do this is so if you hold mouse 2 down, the camera rotates at a speed depending on where the pointer is in relation to the middle of the screen. But it doesn't seem to work right unless the mouse never stops moving so the program never goes idle...
So my question is: Can I have it keeping track of the mouse all the time, even when idle? glutIdleFunc() doesn't work with the Mouse func, incase you didn't know...
09-04-2001, 09:27 PM
Mouse events are sent when you click buttons and move the mouse, and that's the way it should be.
To do the rotation you would start a timer when the mouse button is clicked, the timer takes care of rotating to object, and when the mouse button is released you kill the timer.
It IS possible to do that using the idle func, I use it this way (it only works on Win):
GetCursorPos(&p); // Get the cursor position on the desktop
ScreenToClient(WindowFromPoint(p), &p); // Translate it to window coordinates
And initialize the idle function:
09-20-2001, 04:48 AM
Try using "glutPassiveMotionFunc(motionfunc)" in your initialisation function, where "motionfunc" is your mouse motion function.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.