title: What's going on with my program (openGL in c++)?
body: <p>I am starting with openGL and c++, and I was wondering why I don't see anything on the window. Here is my code:</p>
  
  <pre><code>#include &lt;GLUT/GLUT.h&gt;
  #include &lt;stdlib.h&gt;
  void init() {
      glClearColor(0, 0, 1, 0);
  
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      gluPerspective(60.0, 1.0, 1.0, 100.0);
      glMatrixMode(GL_MODELVIEW);
      glLoadIdentity();
      glTranslatef(0, 0, -10);
  }
  
  void display() {
  
      glClear(GL_COLOR_BUFFER_BIT);
  
      glBegin(GL_TRIANGLES);
      glVertex3i(-0.5, -0.5, 0);
      glVertex3i(0, 0.5, 0);
      glVertex3i(0.5, -0.5, 0);
      glEnd();
  }
  
  
  int main(int argc, char **argv) {
      glutInit(&amp;argc, argv);
      glutInitDisplayMode(GLUT_SINGLE| GLUT_RGBA);
      glutInitWindowPosition(200, 200);
      glutInitWindowSize(400, 400);
      glutCreateWindow("Window");
  
      init();
  
      glutDisplayFunc(display);
  
  
      glutMainLoop();
  }
  </code></pre>
  
  <p>I have a few questions:</p>
  
  <ol>
  <li><p>If I run the program like this all I see is a white window... Didn't I set the color to blue?</p></li>
  <li><p>When I do <code>glutSwapBuffers()</code> at the end of display function and run the program, I see the blue window without the triangle. So, I thought <code>glutSwapBuffers()</code> function only worked with double buffering.</p></li>
  <li><p>And the most important, where the hell is my triangle? O.o Didn't I translate the camera with <code>glTranslatf()</code> function to -10 in the z-axes? If you are wondering why I used gluPerspective, I have to say that I am trying out new things, but neither works if I use gluOrtho2D().</p></li>
  </ol>
  
  <p>I don't know if I am missing something or what. Maybe I need to search more information about this, but I think most of the code is correct. </p>