The Math Behind Perspective Projections

Perspective projections work somewhat differently. They also map part of the virtual world onto the screen, but they do so by using perspective: the further away something is, the smaller it will appear on the screen. The projection matrix can’t do this by itself, so it uses a fourth component, w, in conjunction with the perspective divide. You can read more in Perspective Division.

The following is a very basic perspective projection matrix. This matrix assumes a right-handed coordinate space (see Left-Handed and Right-Handed Coordinate Systems), with the near plane beginning at a z of -1. As a quick exercise, see if you can guess where the far end lies, remembering that OpenGL will divide each component ...

Get OpenGL ES 2 for Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.