PDA

View Full Version : Glut input alternative??



dabeav
06-05-2002, 05:53 AM
I love glut, but I have heard that it is slow for game response. Is this true? I wish to update things each frame, before the camera is drawn. I tried using SDL, but I dont like its setup, its a bit more confusing than I think it should be. I love the glut setup, and being able to set flags for up keys, and down keys, but Will there be a lag when a key is pressed? If there is an alternative i could use please let me know. (open platform ofcourse) and i would also like to continue using glut for everything else it does. Please let me know. Thanks.

coredump
06-05-2002, 07:22 AM
other than the C/C++ input processing functions, platform specific code may be your best bet. for multi-platformed applications it's a small price to pay.

you can achieve what you want (updating each frame) with glut. in your keyboard/mouse functions, set flags for which key/button is down/up. then check those flags each time through your loop. there may be a way to get around the "key repeat" phenomenom (very annoying), but it evades me. good luck.

EDIT: i remembered! glutIgnoreKeyRepeat(1);

b

[This message has been edited by coredump (edited 06-05-2002).]

jmathies
06-05-2002, 09:17 AM
Check out some of the alternative OpenGL
application and game frameworks available.

The OpenGL Toolkit FAQ (http://www.mathies.com/glfaq/\")

rhmazza
06-07-2002, 08:17 AM
Actually, glut only appears to respond slowly to keypresses if you use it a certain way. You don't want to do your updates in the glutKeyboardFunc().

Instead, check out this short web page: http://www.nullterminator.net/glut.html
And look at the way it's done at the very bottom of the page using an array to store the state.

I had lag, but when I switched to this method, it was just as quick as using OS specific commands. But this is platform independent, so it's the better choice. Plus, I think it's the simplest method there is.