The glutKeyboardFunc does not react to key presses immediately
Posted
by
Nibirue
on Stack Overflow
See other posts from Stack Overflow
or by Nibirue
Published on 2012-10-02T20:12:07Z
Indexed on
2012/10/02
21:37 UTC
Read the original article
Hit count: 155
I have a function glutKeyboardFunc(keyboard), where keyboard has:
void keyboard(unsigned char key, int x, int y){
float alpha = 1.0;
switch(key){
case 'c':
glClearColor(1,0,0,alpha);
printf("success");
break;
}
}
This is a summary of the function; it works properly, but only once some other action has occurred. For instance, the printf statement reports success immediately on keystroke 'c', but the background color does not become active until I click somewhere else on the canvas. I want all keystrokes to have an immediate effect.
© Stack Overflow or respective owner