keyboard input

I’m using GLUT keyboard functions (glutSpecialFunc).How to make then to accept more than 1 key (I want to move object not only in up ,down ,left, right direction but also up-left, up-right …)

Originally posted by vlasko:
I’m using GLUT keyboard functions (glutSpecialFunc).How to make then to accept more than 1 key (I want to move object not only in up ,down ,left, right direction but also up-left, up-right …)

I am not a GLUT expert, but with GLFW (http://opengl.freehosting.net/glfw/), which is very similar to GLUT, you can use glfwGetKey() to check for several keys. E.g.:

if( glfwGetKey( GLFW_KEY_UP ) )
{
… move up …
}
if( glfwGetKey( GLFW_KEY_DOWN ) ) {
… move down …
} etc.

/Marcus

Don’t use callback functions, use GetAsyncKeyState (see my reply in the GLUT&Input thread).

How much better is GetAsyncKeyState? I’ve heard that you get better response times. Is there a point in using GetAsyncKeyState if I’m already using a callback function for polling other events?