I've been out of hobby Game Development for quite a while now. Back when I did it, most people used Direct Draw to create 2D games. By the time I stopped people were saying OpenGL or Direct3D with an orthogonal projection is just the way to go.

I'm thinking about getting back into creating 2D games, in particular on mobile phone but maybe on the XNA platform as well. To make something using OpenGL I'd have a (hopefullly) small learning curve to acclimate myself to 3D development.

Is there any reason to skip that and instead work with a 2D framework where I just have a Width x Height frame buffer I need to fill with pixels?

  • \$\begingroup\$ This question is actually wrong... I mean: Direct3D and OpenGL really aren't 3D APIs, are they? They are offering hardware acceleration, but in both 2D and 3D. There's a slight difference there. \$\endgroup\$
    – jacmoe
    Commented Aug 5, 2010 at 0:17

7 Answers 7


You should definitely be using something that uses a 3D renderer on the backend. But in your higher level code, you shouldn't even see the Z axis. All of that should be abstracted away at the lower levels. If you are manipulating pixels directly, you are probably doing something wrong.

For my own games, I built up a set of classes for dealing with 2D objects. My game logic was only dealing with x and y coordinates. My classes also handled things like rotation, scaling, blend modes, etc, etc.

Of course, there are also existing 2D libraries that you can use as well -- Cocos2D is a popular one on the iPhone. Most, if not all, of these libraries will be built upon the lower level 3D APIs so that they benefit from the acceleration available.

  • \$\begingroup\$ I'd be interested to hear how xna handles the 2d api behind the scenes \$\endgroup\$
    – Iain
    Commented Jul 18, 2010 at 7:47
  • 5
    \$\begingroup\$ It's all 3D in the end. Spritebatch, the 2D render workhorse, is a shader effect. \$\endgroup\$
    – drxzcl
    Commented Aug 9, 2010 at 20:46
  • \$\begingroup\$ +1 for decoupling the interface from the implementation. \$\endgroup\$
    – Steve S
    Commented Aug 10, 2010 at 13:52
  • \$\begingroup\$ @Iain Here is a XNA implimentation in DirectX11 written by the XNA authors xnatoolkit.codeplex.com. \$\endgroup\$ Commented Jul 15, 2013 at 17:09

There is a reason to don't use 3D API.

Only computers in NA, North-west EU and Japan support them...

I live in Brazil for example, my sister computer is new, has a multi-core processor, several GB ram, and yet it does not run OpenGL games.

I for example can only play Dwarf Fortress (use OpenGL to render ASCII graphics) on my own computer, on any other computer I find it runs crawling slow.

And this is not a issue only with Brazil, I asked people around, and it is common in several places of the world... The population that actually own OpenGL or Direct3D compatible cards is a minority...

Only that this minority get more attention from companies...

But if you are targeting only these "traditional" markets (NA, Northwest EU, JP), then go for it!

EDIT for those downvoting: Obviously you disagree, so, do you have PROOF that NOONE ships anymore computers with crappy VIA or SIS chips (or even other unknown or worse manufacturers) with none or only OpenGL 1.0 support?

I have TWO machines like that in my house, and they are new (both have more than one core, both have 2GB ram, both have clock frequency above 2GHz...)

My university have 200 machines like that, even some Dell-built ones.

It is plainly simple, GPUs are expensive (even crappy Intel ones), and in poor markets, it is a luxury, people buying machines to run MS Word and read e-mails are not going to buy a machine with a decent graphic chip when they can buy one that is 50 USD cheaper, specially when 50 USD is what most people have to buy food for a entire month.

PLEASE, don't come here saying that I am saying BS, if you never visited a third-world country, and also, don't say that third-world country people don't play games, they do, a lot, Osmos developer post about the Linux version launch of their, pointed that lots of incoming traffic (actually, most of it) was from Russia, plainly because those people are usually ignored.

Here in Brazil, the most popular game is Counter-Strike, running in Software mode... Some Lan-Houses have only 10% of the machines with GPU, even big-ass ones with 200 or even 300 stations...

I should not have posted on this, I knew that it would attract down-votes, I got free loss of points for posting this, every time I explain why my other game uses Allegro 4.4 instead of 5.0 because 5.0 does not support Direct Draw or software mode I get lots of flak from lots of people saying that I am a sort of liar or that I am stupid for saying this truth about the actual availability of OpenGL acceleration.

EDIT 2: To be able to play and develop games that have OpenGL, I had to beg for my parents and other people to buy me a GeForce 8600 (that was the cheapest card that I found that still could ran Mass Effect 1 and other UT3-engine games), they bought me one, but now I am several years without ever getting other gifts again, not even birthday presents, because of how expensive it was, and I hope this card work for more 3 or 4 years...

A pratical example: Eletronic Arts made a new client for Ultima Online that uses 3D acceleration for its 2D graphics... Result: Lots of players complaining of ridicously low framerates, and EA backing down in their decision to enforce the use of the new client (now it is allowed to remain using the old one)

EDIT 4 in 2015: This reply will be left here mostly as historical artifact, currently the amount of computers with extremely crappy chips is low even in third world countries, they still do exist, specially in office-aimed computers, but they are not that common anymore, I don't think it is worth working with Software-mode APIs anymore, OpenGL-based APIs are the way to go now.

  • 3
    \$\begingroup\$ There are no chips out there that don't support 3D today. Most likely you just need to update drivers, because the ones provided by Windows don't come with OpenGL support. The most common crap GPU out there is Intel GMA stuff and even that has some basic OpenGl support. \$\endgroup\$ Commented Jul 22, 2010 at 22:44
  • 1
    \$\begingroup\$ Repeating again: chips here are WORSE than Intel GMA stuff. And yes, some modified drivers do solve the problem, but you can not expect users to know about that. \$\endgroup\$
    – speeder
    Commented Jul 22, 2010 at 23:00
  • \$\begingroup\$ A pratical example: Eletronic Arts made a new client for Ultima Online that uses 3D acceleration for its 2D graphics... Result: Lots of players complaining of ridicously low framerates, and EA backing down in their decision to enforce the use of the new client (now it is allowed to remain using the old one) \$\endgroup\$
    – speeder
    Commented Jul 22, 2010 at 23:15
  • 1
    \$\begingroup\$ The new client is from 2008, what my story says is: People in 2008, disliked a OpenGL client, and reverted to using the 1997 one. \$\endgroup\$
    – speeder
    Commented Jul 23, 2010 at 0:27
  • 1
    \$\begingroup\$ Just because people don't update their drivers doesn't mean their computers don't support OpenGL and Direct3D. The OP should just check for OpenGL / Direct3D compatibility. If it isn't there, he should tell the user to update his drivers. This will work in 98.6% of cases, probably even in the second and third worlds. Seriously though, can you link to a computer you can buy that lacks OpenGL / Direct3D support? \$\endgroup\$
    – Publius
    Commented Jun 8, 2012 at 17:49

No, there isn't. You'll get better effects and faster rendering by using a 3d renderer. For example, here is a 2d game I made a few weeks ago (in one weekend) - the orb effects lean heavily on 3d shaders, even though in many ways they're 2d effects. Similarly, I made extensive use of the available rendering technology for this game - there's three or four different pixel shader effects going on there, all of which let me develop faster and make it prettier.

Embrace the 3d and love it, but love it with one fewer axis.


3D APIs are generally the way to go. Today's GPUs are designed to render 3D graphics, so you're guaranteed pretty solid performance. And as ZorbaTHut said, going the 3D route lets you take advantage of things like pixel shaders.

There really aren't that many 2D APIs out there anymore. DirectDraw has been deprecated, and most of the 2D/vector-based libraries out there use OpenGL or Direct3D to perform their rendering anyway. Even modern UI toolkits are leveraging 3D APIs to do their rendering and compositing. Take WPF (Microsoft's latest UI framework) for example: it uses Direct3D for rendering.


There are still a surprising number of really old machines out there with crappy/non-existent 3d acceleration and drivers that have never been updated, such that using DirectDraw is still going to be way faster than OpenGL or D3D. I experienced this while working on a 2d multiplayer game that is about 10 years old now when I tried to write a new rendering backend in OpenGL to support other platforms. A lot of players reported that the OpenGL mode was unplayable due to low frame rates. I would also agree with the Brazilian poster that this is more common outside of the US and Europe, but it's still true in those places as well.

If you're targeting mobile phones or XNA, then definitely use 3D. But if you want to make a game that runs on any PC, anywhere, I'd say stick with DDraw.


The only thing I can think of is that using a 3D API over a 2D one adds some base complexity. In OpenGL at least, you have to load and manage textures, and when you draw them you need to get the geometry right. A wrapper layer solves these issues.

That said, using a 3D graphics back-end seems to have more upsides than downsides, so if you ask me, it's well worth the effort.


If your game is simple enough, and you want the game to run well on low-end machines, particularly netbooks and older laptops (with no 3D acceleration, or very minimal - older Intel integrated graphics, etc), it's still worth considering a pure 2D framebuffer approach

If you're happy for the game to require at least a low-end ATi/NVidia card/chip, then going using a 3D API will allow you to do a lot of cool stuff (alpha blending, scaling/rotation, etc) that would be tricky to do well/efficiently in a pure software renderer.

Also, be aware that a few things that are very simple in 'pure 2D' become more interesting when 3D hardware (and bilinear filtering/alpha blending) is involved. Understand the concept of premultiplied alpha. And also think about, for example, how you'd handle the seams between tiles in a 2D tilemap if you wanted a zoomable/rotatable view.

Also remember that fillrate is limited. And it's surprisingly easy to reach those limits in 2D. You might not have many polygons, but if you want lots of alpha-blended parallax layers, or particles, or post effects - you can quite easily end up filling as many pixels as a fairly high-end 3D game.

But generally, 3D hardware is awesome, and additive blending is your friend :)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .