Skip to main content
gamedev.net
🔒 Locked

Glut keyboard function

Started by Paul JG Apr 7, 2000 at 7:08 AM 1 replies 600+ views
Original Post
Paul JG
Paul JG
Does anybody know of a fast, easy way in GLUT to scan the keyboard for keys in an idle loop WITHOUT using the keyboard function and resorting to DirectInput. Thanx
gmcbay
gmcbay
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).

Paul JG
Paul JG
Thanks, I`ve given it a try - its good - sort of like programming with glut, one big problem though, The openGL side of things will not render in Fullscreen.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.