O'Reilly logo

OpenGL ES 2 for Android by Kevin Brothaler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Defining an Orthographic Projection

To define an orthographic projection, we’ll use Android’s Matrix class, which resides in the android.opengl package. In that class there’s a method called orthoM, which will generate an orthographic projection for us. We’ll use that projection to adjust the coordinate space, as we just discussed in Adjusting to the Aspect Ratio, and as we’ll soon see, an orthographic projection is very similar to a translation matrix.

Let’s take a look at all of the parameters for orthoM:

orthoM(float[] m, int mOffset, float left, float right, float bottom, float top, float near, float far)

float[] m

The destination array—this array’s length should be at least sixteen elements so it can store the orthographic projection ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required