Пример #1
0
 /**
  * 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);
 }
Пример #2
0
 /**
  * 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);
 }
Пример #3
0
 /** Applies the camera translations along the three axes to the model-view matrix. */
 public void applyTranslations() {
   int previousMatrixMode = glGetInteger(GL_MATRIX_MODE);
   glMatrixMode(GL_MODELVIEW);
   glRotatef(pitch, 1, 0, 0);
   glRotatef(yaw, 0, 1, 0);
   glRotatef(roll, 0, 0, 1);
   glTranslatef(-x, -y, -z);
   glMatrixMode(previousMatrixMode);
 }