click and drag mouse functions in GLUT

Started by
1 comment, last by judge dreadz 18 years, 1 month ago
i'm having difficulty implementing click and drag using the GLUT mouse functions. glutMotionFunc does the dragging part, but there doesnt seem a way to monitor which button initiates the call. glutMouseFunc gives the button, but i cant get it to do the dragging (it moves in one jump when you release the button). i'm trying to make it so dragging the mouse moves the camera position. i want dragging with the left button clicked to rotate the camera about the origin, and dragging with the right button clicked to zoom in/out.
Advertisement
You need to record which button was pressed when glutMouseFunc() fired and use that information to process the dragging accordingly in glutMotionFunc().
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
yep that does the trick, thanks.

This topic is closed to new replies.

Advertisement