title: SFML + OpenGL: Unable to draw cube
body: <p>I've worked with OpenGL before, and it has been a while, but I didn't think it was this bad. There's something I'm missing in this code. I'm just trying to see a cube that I'm drawing using the <code>cube()</code> function. </p>
  
  <p>Things I've done/tried...</p>
  
  <ul>
  <li>flipping the translation between + and - z in the main loop</li>
  <li>turning backface culling on/off before main loop</li>
  <li>glLoadIdentity() at the beginning</li>
  <li>set up my projection at the beginning</li>
  <li>window.resetGLStates() at the beginning</li>
  <li>window.setActive(true) at the beginning</li>
  <li>made sure I stayed in glMatrixMode(GL_MODELVIEW)</li>
  </ul>
  
  <p>What am I missing? All I can see is the clear color I've specified, filling up the screen and taunting me.</p>
  
  <pre><code>#include &lt;SFML/System.hpp&gt;
  #include &lt;SFML/Window.hpp&gt;
  #include &lt;SFML/Graphics.hpp&gt;
  #include &lt;SFML/OpenGL.hpp&gt;
  
  void cube();
  
  int gltest()
  {
      sf::RenderWindow window(sf::VideoMode(800, 600), "SFML works!", sf::Style::Default);
      window.setVerticalSyncEnabled(true);
      window.setActive(true);
      window.resetGLStates();
      sf::Vector2u wsize = window.getSize();
  
      glClearColor(0.3f, 0.3f, 0.3f, 1.f);
      glDepthMask(true);
      glEnable(GL_DEPTH_TEST);
      //to make sure I'm not missing anything here.
      glDisable(GL_CULL_FACE);
  
      glMatrixMode(GL_PROJECTION);
      glViewport(0, 0, wsize.x, wsize.y);
      gluPerspective(60, (float)wsize.x / (float)wsize.y, 0.1f, 512.f);
      glMatrixMode(GL_MODELVIEW);
      glLoadIdentity();
  
      bool running = true;
      while(running)
      {
          sf::Event event;
          while(window.pollEvent(event))
          {
              switch(event.type)
              {
                  case sf::Event::KeyPressed:
                      if(event.key.code != sf::Keyboard::Escape) { break; }
                  case sf::Event::Closed:
                      running = false;
                      break;
                  case sf::Event::Resized:
                      wsize.x = event.size.width;
                      wsize.y = event.size.height;
                      glMatrixMode(GL_PROJECTION);
                      glViewport(0, 0, wsize.x, wsize.y);
                      gluPerspective(60.f, (float)wsize.x / (float)wsize.y, 0.1f, 512.f);
                      glMatrixMode(GL_MODELVIEW);
                      break;
                  default:
                      break;
              }
          }
  
          glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  
              glPushMatrix();
              glTranslatef(0.f, 0.f, 5.f);
  
                  cube();
  
              glPopMatrix();
  
          window.display();
      }
  
      return 0;
  }
  
  void cube()
  {
  glBegin(GL_QUADS);      // Draw The Cube Using quads
      glColor3f(0.0f,1.0f,0.0f);  // Color Green
      glNormal3f(0.f, 1.f, 0.f);
      glVertex3f( 1.0f, 1.0f,-1.0f);  // Top Right Of The Quad (Top)
      glNormal3f(0.f, 1.f, 0.f);
      glVertex3f(-1.0f, 1.0f,-1.0f);  // Top Left Of The Quad (Top)
      glNormal3f(0.f, 1.f, 0.f);
      glVertex3f(-1.0f, 1.0f, 1.0f);  // Bottom Left Of The Quad (Top)
      glNormal3f(0.f, 1.f, 0.f);
      glVertex3f( 1.0f, 1.0f, 1.0f);  // Bottom Right Of The Quad (Top)
      glColor3f(1.0f,0.5f,0.0f);  // Color Orange
      glNormal3f(0.f, -1.f, 0.f);
      glVertex3f( 1.0f,-1.0f, 1.0f);  // Top Right Of The Quad (Bottom)
      glNormal3f(0.f, -1.f, 0.f);
      glVertex3f(-1.0f,-1.0f, 1.0f);  // Top Left Of The Quad (Bottom)
      glNormal3f(0.f, -1.f, 0.f);
      glVertex3f(-1.0f,-1.0f,-1.0f);  // Bottom Left Of The Quad (Bottom)
      glNormal3f(0.f, -1.f, 0.f);
      glVertex3f( 1.0f,-1.0f,-1.0f);  // Bottom Right Of The Quad (Bottom)
      glColor3f(1.0f, 0.0f, 0.0f);    // Color Red
      glNormal3f(0.f, 0.f, 1.f);
      glVertex3f( 1.0f, 1.0f, 1.0f);  // Top Right Of The Quad (Front)
      glNormal3f(0.f, 0.f, 1.f);
      glVertex3f(-1.0f, 1.0f, 1.0f);  // Top Left Of The Quad (Front)
      glNormal3f(0.f, 0.f, 1.f);
      glVertex3f(-1.0f,-1.0f, 1.0f);  // Bottom Left Of The Quad (Front)
      glNormal3f(0.f, 0.f, 1.f);
      glVertex3f( 1.0f,-1.0f, 1.0f);  // Bottom Right Of The Quad (Front)
      glColor3f(1.0f, 1.0f, 0.0f);    // Color Yellow
      glNormal3f(0.f, 0.f, -1.f);
      glVertex3f( 1.0f,-1.0f,-1.0f);  // Top Right Of The Quad (Back)
      glNormal3f(0.f, 0.f, -1.f);
      glVertex3f(-1.0f,-1.0f,-1.0f);  // Top Left Of The Quad (Back)
      glNormal3f(0.f, 0.f, -1.f);
      glVertex3f(-1.0f, 1.0f,-1.0f);  // Bottom Left Of The Quad (Back)
      glNormal3f(0.f, 0.f, -1.f);
      glVertex3f( 1.0f, 1.0f,-1.0f);  // Bottom Right Of The Quad (Back)
      glColor3f(0.0f, 0.0f, 1.0f);    // Color Blue
      glNormal3f(-1.f, 0.f, 0.f);
      glVertex3f(-1.0f, 1.0f, 1.0f);  // Top Right Of The Quad (Left)
      glNormal3f(-1.f, 0.f, 0.f);
      glVertex3f(-1.0f, 1.0f,-1.0f);  // Top Left Of The Quad (Left)
      glNormal3f(-1.f, 0.f, 0.f);
      glVertex3f(-1.0f,-1.0f,-1.0f);  // Bottom Left Of The Quad (Left)
      glNormal3f(-1.f, 0.f, 0.f);
      glVertex3f(-1.0f,-1.0f, 1.0f);  // Bottom Right Of The Quad (Left)
      glColor3f(1.0f, 0.0f, 1.0f);    // Color Violet
      glNormal3f(1.f, 0.f, 0.f);
      glVertex3f( 1.0f, 1.0f,-1.0f);  // Top Right Of The Quad (Right)
      glNormal3f(1.f, 0.f, 0.f);
      glVertex3f( 1.0f, 1.0f, 1.0f);  // Top Left Of The Quad (Right)
      glNormal3f(1.f, 0.f, 0.f);
      glVertex3f( 1.0f,-1.0f, 1.0f);  // Bottom Left Of The Quad (Right)
      glNormal3f(1.f, 0.f, 0.f);
      glVertex3f( 1.0f,-1.0f,-1.0f);  // Bottom Right Of The Quad (Right)
    glEnd();          // End Drawing The Cube
  }
  </code></pre>