title: Opengl back object can be seen from front object
body: <p>I am creating an airport scene.</p>
  <p>I want the tower to be drawn in back of Hangar, also planes inside hangar are also visible.
  If i move my eye point airplanes are also shown behind tower or hangar..
  Also when i look up from below the surface objects are visible too..</p>
  <p>Here is my code...</p>
  <pre><code>void draw()
  {
      glPushMatrix();
      glTranslatef(-8.0, 0, 7);
      drawControlTower(); //grey tower
      glPopMatrix();
      glPushMatrix();
      glTranslatef(5, 1, 0);
      drawHangars(); // Compund to store planes
      glPopMatrix();
  }
  
  static void display()
  {
      if (hiddenDepth) {
          glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
      }
      else 
      {
          glClear(GL_COLOR_BUFFER_BIT);
      }
  
      draw();
      
      /* Check everything OK and update screen */
      CheckGL();
      glutSwapBuffers();
  }
  
  static void initGraphics (void)
  {
      glEnable(GL_DEPTH_TEST);
      glDepthFunc(GL_ALWAYS);
      /* Black background */
      glClearColor(0, 0, 0, 0);
  </code></pre>
  <p>}</p>