From: Gary King Newsgroups: su.class.cs248 Subject: smooth keyboard input Date: Sat, 06 Nov 1999 16:11:39 -0800 After toying around in GLUT 3.7 some more, I have discovered a way to handle keyboard functions that doens't rely on keyboard repeat rates or repeated keypresses to handle interaction. In addition to glutKeyboardFunc, there is an identically prototyped glutKeyboardUpFunc in GLUT 3.7 (I don't believe it exists in 3.6). Instead of handling repeated events in your Keyboard callback, use an array of 256 values (1 for each key value), and set myKeyList[key]=1 in your callback, then handle the event in your onIdle function. Example: Imagine the key 'w' moving the camera along the positive Z axis. in your global variables, you would have: static float camera_x, camera_y, camera_z; static unsigned char myKeyList[256] = {0,0,...0}; in your Display function, you would have { ... glTranslatef(camera_x, camera_y, camera_z); ... // draw objects } in your Idle function, you would have { unsigned int i; ... for (i=0; i<256;i++) if (myKeyList[i]) { switch(i) { case 'w': camera_z += 0.01; break; .. // insert other repeated events here. } } ... } in your keyboard function, you would have { switch (key) { case 27: exit(0); break; // 27 = escape. ... default: myKeyList[key] = 1; } } and in your keyboardup function, you would have { myKeyList[key]=0; } Hope this helps someone