/** * Replaces the projection matrix by the one generated by the camera. The matrix mode will be * returned it its previous value. to GL_MODELVIEW. */ public void applyPerspectiveMatrix() { int previousMatrixMode = glGetInteger(GL_MATRIX_MODE); glMatrixMode(GL_PROJECTION); glLoadIdentity(); GLU.gluPerspective(fov, aspectRatio, zNear, zFar); glMatrixMode(previousMatrixMode); }
/** * Applies an orthographic projection matrix. The matrix mode will be returned it its previous * value. GL_MODELVIEW. */ public void applyOrthographicMatrix() { int previousMatrixMode = glGetInteger(GL_MATRIX_MODE); glMatrixMode(GL_PROJECTION); glLoadIdentity(); // TODO: Add aspect ratio handling for glOrtho glOrtho(-1, 1, -1, 1, 0, 10000); glMatrixMode(previousMatrixMode); }