title: Object, world, camera and projection spaces in OpenGL
body: <p>I'm trying to understand creating spaces in OpenGL:</p>
  
  <ol>
  <li><p>Object space</p></li>
  <li><p>World space</p></li>
  <li><p>Camera space</p></li>
  <li><p>Projection space</p></li>
  </ol>
  
  <hr>
  
  <p>Is my understanding of these stages correct?</p>
  
  <ol>
  <li><p>The "cube" is being created in the center of the cartesian coordinate system, directly inside the program by typing the vertices coordinates.</p></li>
  <li><p>The coordinates are transformed into coordinates inside of the "world", which means moving it to any place on the screen.</p></li>
  </ol>
  
  <p>Well, actually I'd like you to check my understanding of those two terms.</p>
  
  <hr>
  
  <p>Now, I'm creating a triangle on the black screen. How does openGL code fits to these spaces?</p>
  
  <p>It works on <code>GL_MODELVIEW</code> flag by default, but that's the second stage - world space. Does that mean that calling <code>glVertex3f()</code> creates a triangle in the object space?</p>
  
  <p>Where is the world space part?</p>
  
  <hr>
  
  <p>Also, I've read that the last two spaces are not part of the openGL pipeline (or whatever it's called). 
  However, OpenGL contains flags such as the <code>GL_PROJECTION</code>, for example:</p>
  
  <pre><code>glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glViewport(0, 0, w, h); // w - width, h - height
  gluPerspective(45, ratio, 1, 100); // radio = w/h
  glMatrixMode(GL_MODELVIEW);
  </code></pre>
  
  <p>What does this code do? It sets the perspective. Does it create the z axis? But isn't it already the object space part?</p>