title: How to use a 4x4 matrix as a vertex attribute in GLSL?
body: <p>I am trying to use a 4x4 matrix as a vertex attribute, using this code:</p>
  
  <pre><code>Mat4 matrices[numVerts];
  
  int mtxBoneID = glGetAttribLocation(hProgram, "aMtxBone");
  
  glEnableVertexAttribArray(mtxBoneID + 0);
  glEnableVertexAttribArray(mtxBoneID + 1);
  glEnableVertexAttribArray(mtxBoneID + 2);
  glEnableVertexAttribArray(mtxBoneID + 3);
  glVertexAttribPointer(mtxBoneID + 0, 4, GL_FLOAT, GL_FALSE, sizeof(Mat4), ((Vec4*)matrices) + 0);
  glVertexAttribPointer(mtxBoneID + 1, 4, GL_FLOAT, GL_FALSE, sizeof(Mat4), ((Vec4*)matrices) + 1);
  glVertexAttribPointer(mtxBoneID + 2, 4, GL_FLOAT, GL_FALSE, sizeof(Mat4), ((Vec4*)matrices) + 2);
  glVertexAttribPointer(mtxBoneID + 3, 4, GL_FLOAT, GL_FALSE, sizeof(Mat4), ((Vec4*)matrices) + 3);
  
  // shader:
  // ...
  attribute mat4 aMtxBone;
  // ...
  </code></pre>
  
  <p>But all I get on the screen is garbage.</p>