Skip to main content
gamedev.net
🔒 Locked

Input system to complement opengl based rendering engine

Started by MarkB 2 replies 500+ views
Original Post
MarkB
MarkB
The reason I included OpenGL in the topic is to make it clear that I'm not using DirectX-- for anything, Given that, In a general sense what's the best input system-- polled or event driven? Polled would seem to have the problem of too much wasted time, although I don't know how much time is actually spent checking key states. If the app used 50 keys, thats at least 50 wasted function calls per frame- most of the time. This is probably very narrow sighted, since I haven't spent a lot of time analyzing it. That's why I'm asking this question. If you know a reason one is better than the other, lets hear it! Thanks!
Drew_Benton
Drew_Benton
What kind of OpenGL library are you using if any? There are no input libaries per se avaliable that complement DirectInput. SDL has its own system of input as does other libraries such as GLFW, GLUT, and Allegro. If you were to use one of those, you'd have a lot easier time messing with input. Other than that, you are stuck with the Win32 api if you are doing OpenGL in windows.

As for the type to use, I used both in my SDL input library. For maximum contrl over what was happening, I made it so that you could do pretty much anything you wanted to when an input event happened. As for the performance, I have not profiled against anything, but it seems to work quite well. I made it to be an easy addon for any SDL game project, which you should make your system not be one or the other, since it's just complementing the rendering engine.
MarkB
MarkB
I'm not using any libraries other than opengl. Not SDL or DirectX or anything. I will create the input system using system dependant code.
Drew_Benton
Drew_Benton
In that case you are stuck with the Win32 API or linux equivilant. I'd take a look at the NeHe tutorials to see one model of making an input system. (Note: It's not going to be that pretty)

Topic Locked

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

Sign in to reply to this topic.