Example #1
0
void SpecialKeys(int key, int x, int y)
    {

	if(key == GLUT_KEY_F1)
        frameCamera.MoveForward(1.0f);

	if(key == GLUT_KEY_F2)
        frameCamera.MoveForward(-1.0f);

    if(key == GLUT_KEY_DOWN)
        frameCamera.RotateLocalX(0.01f);

	if(key == GLUT_KEY_UP)
        frameCamera.RotateLocalX(-0.01f);

    if(key == GLUT_KEY_LEFT)
        frameCamera.RotateLocalY(0.01f);
      
    if(key == GLUT_KEY_RIGHT)
        frameCamera.RotateLocalY(-0.01f);
    /*if(key == GLUT_KEY_UP)
        xRot-= 5.0f;

    if(key == GLUT_KEY_DOWN)
        xRot += 5.0f;

    if(key == GLUT_KEY_LEFT)
        yRot -= 5.0f;

    if(key == GLUT_KEY_RIGHT)
        yRot += 5.0f;

    if(key > 356.0f)
        xRot = 0.0f;

    if(key < -1.0f)
        xRot = 355.0f;

    if(key > 356.0f)
        yRot = 0.0f;

    if(key < -1.0f)
        yRot = 355.0f;*/

    // Refresh the Window
    glutPostRedisplay();
    }
Example #2
0
// Respond to arrow keys by moving the camera frame of reference
void SpecialKeys(int key, int x, int y)
    {
    if(key == GLUT_KEY_UP)
        viewFrame.MoveForward(0.1f);

    if(key == GLUT_KEY_DOWN)
        viewFrame.MoveForward(-0.1f);

    if(key == GLUT_KEY_LEFT)
        viewFrame.RotateLocalY(0.1);
      
    if(key == GLUT_KEY_RIGHT)
        viewFrame.RotateLocalY(-0.1);
                        
    // Refresh the Window
    glutPostRedisplay();
    }
Example #3
0
void SpecialKey(int value, int x, int y)
{
  if (value == GLUT_KEY_UP)
  {
    cameraPos[2] += 5.5f;
  }
  if (value == GLUT_KEY_DOWN)
  {
    cameraPos[2] -= 5.5f;
  }

  if (value == GLUT_KEY_LEFT)
  {
    camera.RotateLocalY(0.5f);
  }
  if (value == GLUT_KEY_RIGHT)
  {
    camera.RotateLocalY(-0.5f);
  }
  glutPostRedisplay();
}