PDA

View Full Version : Arrow keys



BertusDries
05-07-2011, 03:36 AM
I have an application in which I want to use the arrowkeys.
I am using: glutSpecialFunc( special_keys );
where :
void special_keys(int key, int x, int y){
switch (key){
case GLUT_KEY_UP:
Rotate( -1, 0, 0, 1 );
break;
case GLUT_KEY_DOWN:
Rotate( 1, 0, 0, 1 );
break;
case GLUT_KEY_LEFT:
Rotate( -1, 0, 1, 0 );
break;
case GLUT_KEY_RIGHT:
Rotate( 1, 0, 1, 0 );
break;
}
glutPostRedisplay();
}
I have also a keyboard call back routine which works but This routine doesnot seem to work. If I try a printf statement just before the switch it even does not print so it seems that the routine never is reached. Can anyone help and tell me what I do wrong. The callback routine using the normal ASCII keys work as requested.
I am using Windows 7.

dorbie
05-07-2011, 10:35 PM
Looks ok. Are you sure you are registering the callback?

Also do not mix input methods. If you strip input events with other libraries they may not reach glut so ensure you don't have a rogue event handler somehow removing these key events.