Strange behavior in GLUT Key Up/down

Hi gang,

I wish to detect key-press / release for as many simultaneous keys as possible at a given instant of time only using GLUT api.

I have used c++ code that looks like :

/usual code replaced by … for simplicity/


void keyPressed(unsigned char key, int x, int y) {cout << "pressed " << key << endl;}

void keyReleased(unsigned char key, int x, int y) {cout << "released " << key << endl;}


int main(int argc, char **argv){





Tried this on win2K PC with VC++6.0 GLUT API ver 3. This works as expected as long as I press keys on a single row of the keyboard.

Example: (simultaneoulsy )a,s,d,f,g,h,j,k,l,;,’ pressed and released in any order are detected properly.
But, pressing (simultaneoulsy ) a,s,z,d ‘z’ goes undetected.

And lots of such similar combinations where things can go wrong exist.

Any ideas?

Thanks for reading till this point

The toolkits forum is more appropriate for this post…

– Tom

Clicky .

Thanks a lot. That really helped me.

I was getting doubtful that GLUT api was flawed. I tested out with the more specific case of Win API GetAsyncKeyState. Same problem exists.

so, Keyboards ARE evil