示例#1
0
  /** performs the gl camera transformations for the right eye */
  public void translateRightEye(GL gl, GLU glu, GLUT glut) {
    // calculate the right vector
    Vector3d right = new Vector3d();
    Vector3d temp1 = (Vector3d) cameraTarget.clone();
    temp1.scale(-1);
    Vector3d temp2 = (Vector3d) cameraPosition.clone();

    temp2.add(temp1);
    right.cross(cameraUp, temp2);

    right.normalize();
    right.scale(eyespread / 2.);
    glu.gluLookAt(
        right.x + cameraPosition.x,
        right.y + cameraPosition.y,
        right.z + cameraPosition.z,
        right.x + cameraTarget.x,
        right.y + cameraTarget.y,
        right.z + cameraTarget.z,
        cameraUp.x,
        cameraUp.y,
        cameraUp.z);
  }