title: Passing array of mat4 to GLSL Shader uniform
body: <p>I did run into some trouble setting up my animation shader for my OpenGL application. Basically it takes in an array of 50 glm::mat4 matrices and should set them as uniform in my GLSL shader. Yet only the first value is actually send to the shader, all other array entries in the shader are set to 0.</p>
  
  <p>I think the problem occurs when passing from C++ to GLSL:</p>
  
  <pre><code>class model{
  ...
  glm::mat4 finalBoneTransforms[50];
  ...
  }
  
  model::draw(){
  //Set Joints
  int jointLoc = glGetUniformLocation(shaderID, "jointTransforms");
  glUniformMatrix4fv(jointLoc, 50 , GL_FALSE, glm::value_ptr(finalBoneTransforms[0])); 
  ...
  }
  </code></pre>
  
  <p>So how comes that only the first value is passed? Shouldn't OpenGL take in 50 elements stored in the contiguous memory to the first element, which is referenced via the value_ptr?
  I would highly prefer to use arrays instead of vectors to make sure not to suffer any pointer loss due to reallocation. Arent elements in an array stored in contiguous memory? Any other obvious mistakes causing that weird behaviour?</p>
  
  <p>Edit: Heres the shader code:</p>
  
  <pre><code>#version 330 core
  const int MAX_JOINTS = 50;                              
  const int MAX_WEIGHTS = 4;                              
  
  layout (location = 0) in vec3 aPos;
  layout (location = 1) in vec3 aNormals;
  layout (location = 2) in vec2 aTexCoord;
  layout (location = 3) in vec4 aBoneWeight;
  layout (location = 4) in ivec4 aBoneIndex;
  
  out vec2 texCoords;                             
  
  uniform mat4 jointTransforms[MAX_JOINTS];                   
  uniform mat4 model;
  uniform mat4 view;
  uniform mat4 projection;
  
  void main(void) {                                           
      vec4 totalLocalPos = vec4(0.0);                         
      vec4 totalNormal = vec4(0.0);                       
      for (int i = 0; i&lt;MAX_WEIGHTS; i++) {                       
          mat4 jointTransform = jointTransforms[aBoneIndex[i]];   
          vec4 posePosition = jointTransform * vec4(aPos, 1.0);
          totalLocalPos += posePosition * aBoneWeight[i]; 
  
      }                                                       
      gl_Position = projection*view * totalLocalPos;              
      texCoords = aTexCoord;                              
  
  };
  </code></pre>