title: How do I properly rotate these houses?
body: <p>I am using C++, OpenGL and glut. I am trying to make 5 houses that are rotated properly like this:</p>
  <p><a href="https://i.stack.imgur.com/gCt6c.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gCt6c.png" alt="enter image description here" /></a></p>
  <p>However, whenever I try to implement the <code>glRotatef</code> function, I seem to not be able to either get the proper coordinates or something is off somewhere in my code. Furthermore, I set the background color to white but it's still all black, how come? For now I have the houses set to white to counter this for now. Here is my code:</p>
  <pre><code>#include &lt;GL/glut.h&gt;
  
  typedef int vert2D[2]; 
  
  void initialize()
  {
      glClearColor(1.0, 1.0, 1.0, 0); 
      glMatrixMode(GL_PROJECTION); 
  
      glLoadIdentity(); 
      gluOrtho2D(10.0, 215.0, 0.0, 250.0);  
  
      glMatrixMode(GL_MODELVIEW);
  }
  
  void drawHouse(vert2D* sq, vert2D* tri)
  {
      glColor3f(1.0, 1.0, 1.0); 
  
      glBegin(GL_LINE_LOOP);
      glVertex2iv(sq[0]);
      glVertex2iv(sq[1]);
      glVertex2iv(sq[2]);
      glVertex2iv(sq[3]);
      glEnd();
  
      glBegin(GL_LINE_LOOP);
      glVertex2iv(tri[0]);
      glVertex2iv(tri[1]);
      glVertex2iv(tri[2]);
      glEnd();
  }
  
  void render()
  {
      vert2D sqPts[4] = { {115, 150}, {115, 125}, {100,125}, {100,150} };
      vert2D triPts[3] = { {120, 150}, {95,150}, {108,160} };
  
      glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
      glMatrixMode(GL_MODELVIEW);
  
      drawHouse(sqPts, triPts);
      glPushMatrix();
      glTranslatef(1.0, 0.0, 0.0);
  
      glRotatef(-10.0, 0.0, 0.0, 1.0); 
      drawHouse(sqPts, triPts); 
      glTranslatef(1.0, 0.0, 0.0); 
  
      glRotatef(-10.0, 0.0, 0.0, -1.0);
      drawHouse(sqPts, triPts);
      glPopMatrix();
      glPushMatrix();
      glTranslatef(-1.0, 0.0, 0.0);
  
      glRotatef(10.0, 0.0, 0.0, 1.0); 
      drawHouse(sqPts, triPts); 
      glTranslatef(-1.0, 0.0, 0.0); 
  
      glRotatef(10.0, 0.0, 0.0, 1.0); 
      drawHouse(sqPts, triPts); 
      glPopMatrix(); 
  
      glFlush(); 
  }
  
  int main(int argc, char** argv)
  {
      glutInit(&amp;argc, argv); 
      glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);           
      glutInitWindowPosition(100, 100); 
      glutInitWindowSize(640, 480); 
      glutCreateWindow(&quot;TestMeOut&quot;); 
  
      initialize();
      glutDisplayFunc(render); 
  
      glutMainLoop();
  }
  </code></pre>