title: glPushMatrix inside display list duplicates models
body: <p>I have a display list for some cubes... very simple stuff. Here's a snippet:</p>
  
  <pre><code>GL11.glPushMatrix
  GL11.glRotatef(90,0,0,1)
  cuboid(1,0.5,20) //just glVertex calls
  GL11.glPopMatrix
  </code></pre>
  
  <p>If I use this to draw in immediate mode nothing odd happens. However if I put this in a display list it will first draw the cuboid unrotated and then rotated (or whatever transformation I do between glPushMatrix and glPopMatrix). Moreover, if I don't use glPush and glPop it behaves as expected.</p>
  
  <p>Is there something I should need to know when using glPush/PopMatrix in display lists?</p>
  
  <p>EDIT: adding some more source code:</p>
  
  <pre><code>handle = GL11.glGenLists(1);
  GL11.glNewList(handle,GL11.GL_COMPILE)
  GL11.glBegin(GL11.GL_LINES);
  
  GL11.glPushMatrix //if I don't use these it behaves as expected
  GL11.glRotatef(90,0,0,1)
  cuboid(1,0.5,20) //just glVertex calls
  GL11.glPopMatrix
  
  GL11.glEnd();
  GL11.glEndList();
  </code></pre>
  
  <p>EDIT2: I've made it works by swapping glBegin with glPushMatrix and glEnd with glPopMatrix - I don't like how it looks now but at least it works. From what I know this is NOT normal and what I've done is just a trick, so I'm leaving the question open.</p>
  
  <pre><code>GL11.glPushMatrix //everytime I want to push/pop I have to call glBegin and glEnd
  GL11.glBegin(GL11.GL_LINES);
  GL11.glRotatef(90,0,0,1)
  cuboid(1,0.5,20) //just glVertex calls
  GL11.glEnd();
  GL11.glPopMatrix
  </code></pre>