I'm trying to make a platform game in 2D and I want to know what tool should I use to make it happen. I understand that I can use SDL with openGL. However, if I want to make a solid 2D platform game, should I use SDL? Or, openGL?
closed as off topic by Josh♦, Kylotan, Maik Semder, MichaelHouse♦, Sean Middleditch Jan 3 '13 at 18:53
Questions on Game Development Stack Exchange are expected to relate to game development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.
If you want a lot of fancy effects and sprites on the screen at once, use OpenGL because it supports shaders and is hardware accelerated. If your game is simple and doesn't need a lot of effects or sprites, stick with SDL, especially if it's your first game. SDL isn't hardware accelerated, but it's much easier to use. SDL2 does have hardware acceleration, which also has a very easy API (
Note that if you are going to use OpenGL, you can actually use SDL for everything but graphics at the same time. Other cross-platform windowing libraries that support OpenGL include:
- FreeGLUT - a free implementation of GLUT, which is older and well-documented
- GLFW - similar to FreeGLUT, but more modern (I use this one)
- SFML - this one is a bit more heavyweight, but it's also object-oriented
OpenGL is for rendering polygons on the screen and SDL provides low level access to hardware like joysticks and mice. SDL also provides access to the video frame buffer.
I would suggest you use SDL for hardware stuff and OpenGL for drawing and stay away from the video frame buffer. It's easy enough to create an orthographic projection and position the camera so it's always pointing down at your scene. If you don't want to use polygons you can always use a textured quad as a sprite. This gives you all the power of OpenGL(rotate, while maintaining your 2d platform game feel.
You might also take a look at love2d.org