keyboard polling

This is a discussion on keyboard polling within the Game Programming forums, part of the General Programming Boards category; I'm starting to understand OpenGL and GLUT pretty well, but I always used the glutKeyboardFunc, glutMouseFunc, glutMotionFunc, etc to handle ...

keyboard polling

I'm starting to understand OpenGL and GLUT pretty well, but I always used the glutKeyboardFunc, glutMouseFunc, glutMotionFunc, etc to handle user input. Someone once told me I'd get better results using keyboard polling methods. I don't have the slightest idea how to do that

Since no one wants to talk about polling, perhaps someone would just help me use something better than the glut function. Something asynchronous or whatever. Just help me get better response times from the inputs.

yes... uuuuh. but I've hated DirectX since when I was using a PC, now I'm working with Mac OS X and Linux. So before I get started on DirectX and other Microsoft undocumented APIs, and get myself banned from the forum, does anyone have a non-OS, non-platform based solution ?

Links would be just as much appeciated.

And DavidP, your solution must be great... Can you go into specifics ? I don't quite see an actual implementation.

Not true. The SDK is very well documented. One tripe over to msdn would show you that or one d/l of the DX9 SDK. The help file, while not written for clarity or instructional purposes, is very extensive.

Keep in mind that ANY solution you use in Windows that does not use DirectInput will be slower as far as games are concerned. Windows API was not designed for low-latency environments, especially in the keyboard functions.

Face it, the days when you could design a game or an engine independent of an OS are gone. You must use the OS in order to access the hardware...hence the design philosophy behind 32-bit operating systems operating in protected mode and thus the near removal of the interrupt driven OS (not entirely but close).

Notice in the above example you must wait for a message to be sent before retrieving key presses. With DirectInput this is not so and no messages are sent, hence it is not a message-based input library, although it does have other features that are.