• Advertisement
Sign in to follow this  

2D game drawing

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

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.

Share this post


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

Share this post


Link to post
Share on other sites
[quote name='Nairou' timestamp='1339962798' post='4950072']
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.
[/quote]
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. Edited by Servant of the Lord

Share this post


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

  • Advertisement