2D game drawing

Started by
1 comment, last by Servant of the Lord 11 years, 10 months ago
What method do people generally use for doing rendering in a 2D game? Not just a 2D interface on a 3D game, but an entirely 2D game.

So far I've only worked with 3D games, and I know you can use an orthogonal projection matrix to make things look 2D, but is this how most 2D-only games generally work?

I ask because it seems like a lot of overhead to have to deal with the full 3D pipeline of triangle meshes and shaders and 3D matrices when all you want to do is draw some 2D boxes and lines on the screen.

I've heard of Direct2D, for 2D drawing in Windows, but I haven't looked into it at all, and I'm hoping for a cross-platform solution. Other 2D drawing libraries I've seen (i.e. Cairo) seem to be more about image generation, and not hardware-accelerated real-time rendering.
Advertisement
Textured quad is probably the best method. If your looking for cross platform use OpenGL. I'm not sure how Direct2D works but it's probably the same method. I think the quads are also cached and drawn all at once rather than one at a time.

Brendon Glanzer


I've heard of Direct2D, for 2D drawing in Windows, but I haven't looked into it at all, and I'm hoping for a cross-platform solution. Other 2D drawing libraries I've seen (i.e. Cairo) seem to be more about image generation, and not hardware-accelerated real-time rendering.

If you are using C++, try SDL or SFML. SDL is mostly software based but can do hardware rendering, whereas SFML is fully hardware rendering. SFML is built ontop of OpenGL, and also offers easy window creation and input handling (plus audio via OpenAL).

SDL is C or C++, but SFML is designed for C++, with nice small and compact C++ classes. Both are cross platform for at least Windows, Linux, and Mac.

This topic is closed to new replies.

Advertisement