Originally posted by Inquisitor: Use GetKeyboardState or GetKeyState functions.
Or better, use DirectInput.
Shouldn’t be too hard to find some appropriate tutorials.
I have solved my problem like this:
use glutKeyboardFunc to register the call back function to get some key down message
use glutKeyboardUpFunc to register the call back function to get some key up message
and glutKeyboardIngoreRepeat to ingore the auto repeat message when any key is held down