Original Post
🔒 Locked
Glut keyboard function
Advertisement
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 (http://www.devolution.com/~slouken/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).
My other suggestion is to look at SDL (http://www.devolution.com/~slouken/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).
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement