Home » Android » android – OpenGL (ES) — What's the difference between frustum and ortho?

# android – OpenGL (ES) — What's the difference between frustum and ortho?

Questions:

When I use each of them with the same parameters the only difference I notice is how close the ‘camera’ is from the objects. What is the difference here, and which is preferred for a mainly 2D game?

I don’t agree with LeffelMania, although his answer is already accepted, I would like to explain again what a frustum is and what the differences between orthographic and perspective projections are.

A frustum is a pyramid without the top shaped 3D object (in the link defined by the space between the zNear and zFar plane).

The frustum is used to determine what the camera can see. Everything that is inside or intersects with the camera’s view-frustum has to be rendered, all the rest can be ignored.

Because a frustum is a difficult shape to do intersection checks on, often a matrix transform is constructed so that the view frustum is transformed to a cube. This matrix transform is also applied to all scene objects so that we can now do a simple ‘does it intersect with a cube’ check. This is called the canonical view frustum (see more info here)

Now about perspective vs orthographic projection. In the picture you see the camera, or center of projection (COP). In a perspective projection the COP is near the near plane. Rays from all positions on the far plane are pointing at the COP. Where these rays intersect the near plane (aka viewport) a pixel is colored according to the color of the closest thing to the near plane that the ray hit. A perspective projection leads to (multiple) vanishing points and objects further away from the camera are smaller, also parallel lines in the world are not necessarily parallel on the picture.

In an orthographic projection the COP is infinitely far away, so the rays are almost parallel to each other. There is no vanishing point, more distant objects are not drawn smaller and parallel lines in the world are parallel on the picture.