title: Get Projection Matrix from OpenGL in version 3.3
body: <p>For compatibility reasons I have to mix old and modern OpenGL code. I would like to retrieve the current projection- and modelview-matrix from OpenGL to pass it to the shader by using a uniform-variable. </p>
  
  <p>The following code shows my attempt to do that for the projection-matrix only. It does <em>not</em> work as intended:</p>
  
  <pre><code>float m[16];
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(60, aspect, 0.01f, 2.0f);
  glGetFloatv(GL_PROJECTION_MATRIX, m);
  </code></pre>
  
  <p>After these lines Matrix <code>m</code> contains the identity. I checked this using the following code:</p>
  
  <pre><code>printf("%f %f %f %f\n", m[0], m[4], m[8],  m[12]);
  printf("%f %f %f %f\n", m[1], m[5], m[9],  m[13]);
  printf("%f %f %f %f\n", m[2], m[6], m[10], m[14]);
  printf("%f %f %f %f\n", m[3], m[7], m[11], m[15]);
  </code></pre>
  
  <p>I created the context using <a href="http://freeglut.sourceforge.net/" rel="nofollow">freeglut</a> and explicitly requested an OpenGL 3.3 context using the following code:</p>
  
  <pre><code>...
  glutInitContextVersion(3, 3);
  glutCreateWindow(title);
  </code></pre>
  
  <p>When I change the version to OpenGL 2.0 the code above works as expected. Every version above produces the described problem.</p>
  
  <p>I'm working on Xubuntu using an <em>Intel Corporation Broadwell-U Integrated Graphics</em>.</p>
  
  <p><strong>Can someone explain this behaviour? Can someone offer a solution?</strong></p>