• Advertisement
Sign in to follow this  

Input system to complement opengl based rendering engine

This topic is 4525 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

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!

Share this post


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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement