Keyboard Input

Hello,
I’v started learning OpenGL and am a bit stuck! I’v got a polygon to rotate around its centre but wish to be able to control it through the keyboard. I’v managed this and it changes direction when I press the LEFT/RIGHT keys Once!!! I want my polygon to move only when I hold down the keys, not when I just press once.

Is this something to do with
keyPressed()
keyTyped()
or
key released?

I’v put my method in keyPressed

Does anyone have any ideas? Thanks very much, this is really confusing me

btw I’m using C++.

stuff like keyboard input isn’t standardized in c++. what you need to do depends on what windowing framework you’re using. if you’re using win32, look up the GetKeyState() function. or better yet, consider handling the WM_BUTTON messages. if you’re using glut, take a look at glutKeyboardFunc() .

-steve

EDIT: ubb code is really stupid.

[This message has been edited by SThomas (edited 04-26-2003).]