title: i want to create 3D pyramid by OpenGL
body: <p>I want to create a 3d pyramid by using only boxes.</p>
  
  <p>I know that there is a function to appear pyramid but I want to try using only boxes with for loop. But I stuck with that coding. So I want to ask somebody who can help me out with this problem with the code shown.</p>
  
  <p>This is my code.</p>
  
  <pre><code>int i = 1;
  int x;
  
  for(i=1;i&lt;7;i++)
  {
      {
          for(x=0; x&lt;i ; x++)
          {
              glPushMatrix();
              translate(1-x+sqrt(i)+(i)+1/6,0,1/6);
              glutSolidCube(1.0);
              glPopMatrix();
          }
          translate(-1, -1, 0);
      }
      rotate(rotation,0,1,0);
  }
  glPopMatrix();
  </code></pre>