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 ... |
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.