Defining a Perspective Projection

To recreate the magic of 3D, our perspective projection matrix needs to work together with the perspective divide. The projection matrix can’t do the perspective divide by itself, and the perspective divide needs something to work with.

An object should move toward the center of the screen and decrease in size as it gets further away from us, so the most important task for our projection matrix is to create the proper values for w so that when OpenGL does the perspective divide, far objects will appear smaller than near objects. One of the ways that we can do that is by using the z component as the distance from the focal point and then mapping this distance to w. The greater the distance, the greater the w

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.