Why does glutTimerFunc() only execute my callback once?
GLUT’s function for starting a timer and specifying a timer callback, glutTimerFunc(), is specified to execute the callback after the elapsed time, then delete the timer. This is the way timers work in several APIs. Often, repeated callbacks are useful. Implement this by resetting the timer within your callback routine. For example, the following timer callback routine resets the timer for repeated callbacks: static void timerCallback (int value) { /* Do timer processing */ /* maybe glutPostRedisplay(), if necessary */ /* call back again after elapsedUSecs have passed */ glutTimerFunc (elapsedUSecs, timerCallback, value); } 3.030 I need to set up different tasks for left and right mouse button motion. However, I can only set one glutMotionFunc() callback, which doesn’t pass the button as a parameter. You can easily set up different tasks depending on the state of the SHIFT, ALT, and CTRL keys by checking their state with glutGetModifiers().