title: OpenGL door animation
body: <p>I'm trying to animate a door so that if I press a button the door will open. At the moment it compiles, and when I go to press the button it moves the camera and then I can't control the camera anymore. What is wrong with the code?</p>
  
  <pre><code>glPushMatrix;
  glTranslatef (door_Xpos,0.0, 0.0);
  glRotatef (door_Angle, 1,0,0);
  
  glBegin(GL_QUADS);
  
  //Door left
  glColor3f(0.2f, 0.2f, 0.2f);
  glVertex3f(-10.0, 0.0, -25.0);
  glColor3f(0.4f, 0.4f, 0.4f);
  glVertex3f(-10.0, 15.0, -25.0);
  glColor3f(0.6f, 0.6f, 0.6f);
  glVertex3f(0.0, 15.0, -25.0);
  glColor3f(0.8f, 0.8f, 0.8f);
  glVertex3f(0.0, 0.0, -25.0);
  
  //door right
  glColor3f(0.2f, 0.2f, 0.2f);
  glVertex3f(10.0, 0.0, -25.0);
  glColor3f(0.4f, 0.4f, 0.4f);
  glVertex3f(10.0, 15.0, -25.0);
  glColor3f(0.6f, 0.6f, 0.6f);
  glVertex3f(0.0, 15.0, -25.0);
  glColor3f(0.8f, 0.8f, 0.8f);
  glVertex3f(0.0, 0.0, -25.0);
  
  glPopMatrix;
  
  void keyboard(unsigned char key, int x, int y)
  {
      switch (key)
      {
          case 'a':
          case 'A':
              glTranslatef(5.0, 0.0, 0.0);
              break;
  
          case 'd':
          case 'D':
              glTranslatef(-5.0, 0.0, 0.0);
              break;
  
          case 'w':
          case 'W':
              glTranslatef(0.0, 0.0, 5.0);
              break;
  
          case 's':
          case 'S':
              glTranslatef(0.0, 0.0, -5.0);
              break;
  
          case 't':
          case 'T':
              if (is_depth)
              {
                  is_depth = 0;
                  glDisable(GL_DEPTH_TEST);
              }
              else
              {
                  is_depth = 1;
                  glEnable(GL_DEPTH_TEST);
              }
  
          #Fall-through...
          case 'o':
          case 'O':
              door_Xpos += 90.0;
              break;
      }
      display();
  }
  </code></pre>