I am trying to build an engine using OpenGL however I have a question about the kind of projection to use.

  1. For a 2D game should I use a perspective projection or an orthographic projection?

  2. If I wanted to have the ability to use 3d in a 2d oriented game, which one should I use?

  • 4
    \$\begingroup\$ Your chosen projection matrix has no effect on whether or not the graphics framework will support 2D or 3D. Also, projection matrices are trivial to change out, so why not just give them both a try? \$\endgroup\$
    – Evan
    Commented Jun 4, 2014 at 14:44

1 Answer 1


Using orthographic projection means everything will be projected to a 2D plane and objects will not be affected by the distance and/or angle from which you see them. Look at the image and you'll understand: enter image description here

The two objects are exactly the same, but they are projected differently. Notice how distance affects what you see if you're using perspective projection. That gives the 3D touch to the engine. You don't need that in a 2D game.

If you don't want to include 3D in your engine you should be using an orthographic projection and an eye point (the point from which you are looking at the environment) above the ground.

  • \$\begingroup\$ Thats great thanks. I have another question. If I use a perspective projection, how are you supposed to size your objects? For example I have a sprite that is 16x16 (pixels), how are you supposed to convert that into OpenGL coords (-1, 1)? \$\endgroup\$
    – Nick
    Commented Jun 4, 2014 at 15:59
  • 1
    \$\begingroup\$ I just mentioned perspective projection because you asked about it, but in a 2D engine you really don't need it. It must operate on the z-axis, which you don't have when working in 2D. \$\endgroup\$
    – Lighthink
    Commented Jun 4, 2014 at 16:55
  • \$\begingroup\$ Yeah I realize that, but what if I wanted to include some 3D stuff. \$\endgroup\$
    – Nick
    Commented Jun 4, 2014 at 17:24
  • \$\begingroup\$ At the minute i have this imgur.com/1WCFxVM It is running a perspective projection displaying a 3d model and a sprite. The problem is that i have to specify the coords as: -1,1,0 etc which makes it kind of hard to position stuff. How do people deal with this? \$\endgroup\$
    – Nick
    Commented Jun 4, 2014 at 17:32
  • \$\begingroup\$ If you want to have both 2D and 3D stuff, then you'll need to draw the 2D and 3D objects separately. You should also use a perspective projection for 3D. I never used OpenGl, but as for rendering sprites, I don't think they need any kind of projection since they have only 2 coordinates that can transformed into screen coordinates in a straightforward manner. \$\endgroup\$
    – Lighthink
    Commented Jun 5, 2014 at 12:54

You must log in to answer this question.

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