This topic is now archived and is closed to further replies.

Paul JG

Glut keyboard function

Recommended Posts

The ''Right Way'' to handle the keyboard in GLUT is to use the glutKeyboardFunc callback function. I guess you don''t want to do this for some reason and want to poll for keypresses manually. You could, instead, use GetAsyncKeyState(). Its simple to use and saves you from having to wade through DirectInput setup. It is, however, Windows-only.

My other suggestion is to look at SDL ( SDL is a wrapper API that gives you a common interface to DirectX-style APIs in a cross-platform manner (Win32, Linux/UNIX, MacOS, BeOS). It supports OpenGL rendering in the newest versions and does many of the things GLUT will do for you in terms of abstracting the underlying OS. You might find its programming style is more suited to you and/or your game/application than GLUT is. Also, its more actively supported. GLUT seems to be forever stuck at 3.7 Beta, with the principle author working on many other things (at NVidia).

Share this post

Link to post
Share on other sites