title: Opengl and c++ drawing multiple cubes
body: <p>So I am able to draw a cube, but I want to draw multiple cubes, and I don't know how. Can you guys help me? 
  This is the code of how I draw the cube:</p>
  
  <pre><code>#include &lt;GL/freeglut.h&gt;
  #include &lt;stdlib.h&gt;
  
  void initGL(int width, int height)
  {
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,2.0f,100.0f);
      glMatrixMode(GL_MODELVIEW);
  
      const GLfloat light_ambient[]  = { 0.0f, 0.0f, 0.0f, 1.0f };
      const GLfloat light_diffuse[]  = { 1.0f, 1.0f, 1.0f, 1.0f };
      const GLfloat light_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f };
      const GLfloat light_position[] = { 2.0f, 5.0f, 5.0f, 0.0f };
      const GLfloat mat_ambient[]    = { 0.7f, 0.7f, 0.7f, 1.0f };
      const GLfloat mat_diffuse[]    = { 0.8f, 0.8f, 0.8f, 1.0f };
      const GLfloat mat_specular[]   = { 1.0f, 1.0f, 1.0f, 1.0f };
      const GLfloat high_shininess[] = { 100.0f };
      glEnable(GL_LIGHT0);glEnable(GL_LIGHTING);
      glLightfv(GL_LIGHT0, GL_AMBIENT,  light_ambient);
      glLightfv(GL_LIGHT0, GL_DIFFUSE,  light_diffuse);
      glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
      glLightfv(GL_LIGHT0, GL_POSITION, light_position);
      glMaterialfv(GL_FRONT, GL_AMBIENT,   mat_ambient);
      glMaterialfv(GL_FRONT, GL_DIFFUSE,   mat_diffuse);
      glMaterialfv(GL_FRONT, GL_SPECULAR,  mat_specular);
      glMaterialfv(GL_FRONT, GL_SHININESS, high_shininess);    
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,2.0f,100.0f);
      glMatrixMode(GL_MODELVIEW);
      glEnable(GL_CULL_FACE);glCullFace(GL_BACK);
  }
  
  static void display(void)
  {
      glLoadIdentity(); 
      glPushMatrix();
          glTranslatef(0.0,0.0,-10); 
          glRotatef(60,1,0,0);
          glRotatef(60,0,1,0); 
          glutSolidCube(2); 
  
          glLoadIdentity();
          glTranslatef(0.0,0.0,-10); 
          glRotatef(60,1,0,0); 
          glRotatef(60,0,1,0);
          glutSolidCube(2); 
      glPopMatrix();
      glFlush(); 
  
  }
  
  static void idle(void)
  {
      glutPostRedisplay();
  }
  
  int main(int argc, char *argv[])
  {
      int width = 640;
      int height = 480;
      glutInit(&amp;argc, argv);
      glutInitWindowSize(width,height);
      glutInitWindowPosition(10,10);
      glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
      glutCreateWindow("Lab 1: Hello OpenGL World !");
      glutDisplayFunc(display);
      glutIdleFunc(idle);
      initGL(width, height);
      glutMainLoop();
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>I need to draw multiple cubes like the one that I am drawing. I tried with a for but I just started opengl today and don't know what I'm doing. I have tried multiple things and got very annoyed. Do you also recommend any book?</p>