Jump to content
  • Advertisement

Archived

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

Paul JG

Glut keyboard function

This topic is 6801 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!