Just wondering if its a bad Idea to use glut for making a openGL game? From what I have played around with it seems like Glut reacts slower to keyboard input…like if I hold a key down it doesnt seem to repeat that key as fast as windows code does?
There are plenty of games done with GLUT so I think it should work fine, not sure if it is crappier at keyboard input though, I havn’t used it in a long time.
u need to turn glutignorekeyboardrepeat(…)sp? on .
and + use the glutkeyboard(…) + keyboardUp(…) functions
(check the help or headers for the correct spelling/syntax)
- use someit like so
bool KEYA_pressed = false;
case ‘a’: KEYA_pressed = true; break;
switch (key )
case ‘a’: KEYA_pressed = false; break;
if (KEYA_pressed == true ) do someit
I seem to remember reading somewhere that glut only calls the idle func 18 times a second so it was only good for games that don’t require frequent update loop. I think it read it in Thatcher Ulrich’s Quadtree landscape demo.
Check it out before hand, that would really screw you if so as glut takes control once you start it up…
Search for GetAsyncKeyState() at http://msdn.microsoft.com. It works great and you can also check for shift, ctrl etc. You can also press several key simultanously.
I think SDL is easier to use than glut. And you don’t have to use the stupid “glutMainLoop”. www.libsdl.org
Are you totally sure you HAVE to use the glutMainLoop?? I have never tried, but it may be possible NOT to use it and instead use the program as if it were Win32 OpenGL… Im just speculating here…
When entering the mainloop, GLUT creates a context, creates the window and starts calling your callback functions. Note, the window and the OpenGL rendering context, is not created until you call glutMainLoop.
So if you don’t like glutMainLoop, you must create the window and the context yourself, and start calling your display/resize/idle/keyboard/mouse functions yourself. And not only do you have to call your keyboard/mouse functions, you must get the keypress/mousecoord yourself aswell.
So, to sum it up, GLUT is totally useless without glutMainLoop. It does not provide any kind of service, apart from rendering some basic primitives, like cubes, spheres, cones, and stuff like that. Totally useless.
You can do games in glut, there are however better ways…
A cool Glut-based game.
Too bad it doesn’t run on my PC and runs slower than many other games on other PCs…