Because OpenGL is stateful, how do you target a specific matrix especially in OpenGL ES 1.x (a fixed function pipeline)? For example we know that when we call glFrustum() it sets up the projection matrix, but the documentation suggests that if takes the current matrix and multiplies with the projection matrix? But there are more than one matrix: many matrices that are model, and at least one more that is a view matrix?


//Indicate we are going to target the projection matrix
//There other constants to indicate other matrices
//as targets for subsequent methods that manipulate and set matrices.
gl.glMatrixMode(GL10.GL_PROJECTION);

// Set that matrix to the identity matrix
gl.glLoadIdentity();

//This multiples the previous matrix with the projection matrix
gl.glFrustumf(-ratio, ratio, -1, 1, 3, 7);

See the docs for glMatrixMode

and you have the ability to explicitly control the matrix variables and hence the state doesn't matter and you work more like a local variable and not a global variable.


//See how similarly we are working with and setting the model/view matrix
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
GLU.gluLookAt(gl, 0, 0, -5, 0f, 0f, 0f, 0f, 1.0f, 0.0f);