Why do people use SDL with OpenGL?,
Banned - Reputation: 109
Posted 13 April 2011 - 10:47 AM
Members - Reputation: 3019
Posted 13 April 2011 - 11:15 AM
Sure, all the functionality is provided by underlying code you could also be writing. But why rewrite it? There is usually no need, so most people just grab a wrapper.
Members - Reputation: 223
Posted 13 April 2011 - 11:16 AM
SDL tries to be the proverbial Jack of all trades, and naturally is master of none. The best thing is to use different libraries optimized for each specific thing you need. In some cases, you can even beat the native Windows API for things such as mutexes: http://locklessinc.com/articles/keyed_events/ (also check other articles on this site for more, it's a goldmine or extreme optimization)
I've played with OpenGL before but not for very long. I've noticed that the id tech engine uses SDL alongside OpenGL but I don't really understand why? DirectX 10 uses on screen quads with textures to render 2d sprites so I'm wondering why not just do that with OpenGL? I'm pretty sure playing 3d audio would still require OpenAL so why even use SDL for audio? On top of that I'm pretty sure anything else SDL does would be covered by wxWidgets or even GLFW. Why is SDL the standard?
~~~~~~~~~~~~~~~Looking for a high-performance, easy to use, and lightweight math library? http://www.cmldev.net/ (note: I'm not associated with that project; just a user)
Members - Reputation: 123
Posted 13 April 2011 - 12:21 PM
DirectX 10 uses on screen quads with textures to render 2d sprites so I'm wondering why not just do that with OpenGL?
They are. When you use OpenGL with SDL, you can't use any of the SDL drawing functions because those are only designed to work in software rendering mode. When you use SDL with OpenGL, you're using it as a cross-platform input and window-management wrapper.
Moderators - Reputation: 10573
Posted 13 April 2011 - 12:37 PM