Jump to content

  • Log In with Google      Sign In   
  • Create Account

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: 418

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   Members   -  Reputation: 459

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


#3 Servant of the Lord   Crossbones+   -  Reputation: 19665

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.

It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.
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

[Fly with me on Twitter] [Google+] [My broken website]

[Need web hosting? I personally like A Small Orange]





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