Game Development Reference
In-Depth Information
ď?®
There's a special matrix called an
identity matrix . If we multiply a matrix or
a point with it, nothing will happen. Think of multiplying a point or matrix
by an identity matrix as multiplying a number by 1. It simply has no effect.
The relevance of the identity matrix will become clear once you learn how
OpenGL ES handles matrices (see the section “Matrix Modes and Active
Matrices�)—a classic chicken and egg problem.
Note
When we talk about points in this context, we actually mean 3D vectors.
OpenGL ES has three different matrices that it applies to the points of our models:
ď?® Model-view matrix : We can use this matrix to move, rotate, or scale the
points of our triangles (this is the model part of the model-view matrix). This
matrix is also used to specify the position and orientation of our camera (this
is the view part).
� Projection matrix : The name says it all—this matrix encodes a projection,
and thus the view frustum of our camera.
ď?® Texture matrix : This matrix allows us to manipulate texture coordinates
(which we'll discuss later). However, we'll avoid using this matrix in this topic
since this part of OpenGL ES is broken on a couple of devices thanks to
buggy drivers.
The Rendering Pipeline
OpenGL ES keeps track of these three matrices. Each time we set one of the matrices, OpenGL
ES will remember it until we change the matrix again. In OpenGL ES speak, this is called a state .
OpenGL keeps track of more than just the matrix states, though; it also keeps track of whether
we want to alpha-blend triangles, whether we want lighting to be taken into account, which
texture should be applied to our geometry, and so on. In fact, OpenGL ES is one huge state
machine; we set its current state, feed it the geometries of our objects, and tell it to render an
image for us. Let's see how a triangle passes through this mighty triangle-rendering machine.
Figure 7-4 shows a very high-level, simplified view of the OpenGL ES pipeline.
Figure 7-4. The way of the triangle
 
 
Search WWH ::




Custom Search