Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

2D game drawing


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Nairou   Members   -  Reputation: 366

Like
0Likes
Like

Posted 17 June 2012 - 01:53 PM

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.

Sponsor:

#2 bglanzer   GDNet+   -  Reputation: 189

Like
0Likes
Like

Posted 17 June 2012 - 02:04 PM

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
reflexcode

#3 Servant of the Lord   Marketplace Seller   -  Reputation: 8951

Like
0Likes
Like

Posted 17 June 2012 - 02:21 PM

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.

Edited by Servant of the Lord, 17 June 2012 - 02:22 PM.

All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.

Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS