title: Where points OpenGL z-axis?
body: <p>I'm trying to understand OpenGL coordinate system. Everywhere I see it's described as right-handed one, but it doesn't correspond with my experience. I tried to draw some shapes and 3-d objects and I see that apparently z-axis points "into the screen" (while x points to right, and y up - which is description of left-handed coordinate system). What am I missing?</p>
  
  <p>edit:
  For example: <br />
  <a href="http://img576.imageshack.us/img576/9234/triangles.jpg" rel="noreferrer">http://img576.imageshack.us/img576/9234/triangles.jpg</a> <br/>
  If +Z points viewer, why green triangle, which z-coordinate is larger,  is behind red one?</p>
  
  <p>initializeGL:</p>
  
  <pre><code>qglClearColor(Qt::darkGray);
  glClearDepth(1.0);
  glEnable(GL_DEPTH_TEST);
  glDepthFunc( GL_LEQUAL );    
  glEnable(GL_COLOR);  
  </code></pre>
  
  <p>resizeGL:</p>
  
  <pre><code>glViewport(0, 0, width, height);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glOrtho(-50.0f, 50.0f, -50.0f, 50.0f, 50.0, -50.0);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  </code></pre>
  
  <p>paintGL:</p>
  
  <pre><code>glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glLoadIdentity();
  glRotatef (-30.0, 1.0, 0.0, 0.0);
  glRotatef (20.0, 0.0, 1.0, 0.0);
  glColor3f(1.0, 0.0, 0.0);
  glBegin(GL_LINES);
  glVertex3f(45.0, 0.0, 0.0);
  glVertex3f(-45.0, 0.0, 0.0);
  glVertex3f(0.0, 45.0,  0.0);
  glVertex3f(0.0, -45.0,  0.0);
  glVertex3f( 0.0, 0.0, 45.0);
  glVertex3f( 0.0, 0.0, -45.0);
  glEnd();
  glBegin(GL_TRIANGLES);
  //Red triangle:
  glColor3f(1.0, 0.0, 0.0);
  glVertex3f(0.0, 0.0, 1.0);
  glVertex3f(0.0, 20.0, 1.0);
  glVertex3f(20.0, 0.0, 1.0);
  //Green triangle:    
  glColor3f(0.0, 1.0, 0.0);
  glVertex3f(-15.0, 0.0, 20.0);
  glVertex3f(0.0, 25.0, 20.0);
  glVertex3f(15.0, 0.0, 20.0);
  glEnd();
  </code></pre>