public final void glPopMatrix() { float[] stackEntry = null; if (matrixMode == GL_MODELVIEW) { stackEntry = matrixMvStack.remove(0); } else if (matrixMode == GL_PROJECTION) { stackEntry = matrixPStack.remove(0); } else if (matrixMode == GL.GL_TEXTURE) { stackEntry = matrixTStack.remove(0); } glLoadMatrixf(stackEntry, 0); }
public void lookat( float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ, PMVMatrix matrix) { Vec3 f = new Vec3(centerX - eyeX, centerY - eyeY, centerZ - eyeZ); f.Nor(); Vec3 U = new Vec3(upX, upY, upZ); U.Nor(); Vec3 s = f.Cro(U); s.Nor(); Vec3 u = s.Cro(f); u.Nor(); float[] mat = { s.x, u.x, -f.x, 0, s.y, u.y, -f.y, 0, s.z, u.z, -f.z, 0, -eyeX * s.x + -eyeY * s.y + -eyeZ * s.z, -eyeX * u.x + -eyeY * u.y + -eyeZ * u.z, -eyeX * -f.x + -eyeY * -f.y + -eyeZ * -f.z, 1 }; matrix.glMatrixMode(GL2.GL_MODELVIEW); matrix.glLoadMatrixf(mat, 0); }
public void lookatd( double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ) { Vec3d f = new Vec3d(centerX - eyeX, centerY - eyeY, centerZ - eyeZ); f.Nor(); Vec3d U = new Vec3d(upX, upY, upZ); U.Nor(); Vec3d s = f.Cro(U); s.Nor(); Vec3d u = s.Cro(f); u.Nor(); float[] mat = { (float) s.x, (float) u.x, (float) -f.x, 0, (float) s.y, (float) u.y, (float) -f.y, 0, (float) s.z, (float) u.z, (float) -f.z, 0, (float) (-eyeX * s.x + -eyeY * s.y + -eyeZ * s.z), (float) (-eyeX * u.x + -eyeY * u.y + -eyeZ * u.z), (float) (-eyeX * -f.x + -eyeY * -f.y + -eyeZ * -f.z), 1 }; pvmat.glMatrixMode(GL2.GL_MODELVIEW); pvmat.glLoadMatrixf(mat, 0); }