Having an issue with updating a uniform buffer


I have a uniform buffer defined in glsl as follows

layout (binding = 2, std140) uniform matrixBuffer
mat4 modelMatrix;
mat4 modelViewProjectionMatrix;
mat4 normalMatrix;
mat4 lightModelViewProjectionMatrix;

and I create a uniform buffer by doing the following (id is a valid value, 7 in my case)

glBindBuffer(GL_UNIFORM_BUFFER, id);
glBindBufferBase(GL_UNIFORM_BUFFER, 2, id);

and update it by doing (again id is the value used in initialisation)

glBindBuffer(GL_UNIFORM_BUFFER, id);
glBufferSubData(GL_UNIFORM_BUFFER, 0, data);

When I use the below to check the contents of the uniform buffer the contents are correct.


But the shader doesn’t seem see the updated values, when I look in renderdoc the values are all 0 (and nothing is displayed). The vertex / index data looks good in renderdoc but glPosition is wrong

vec4 position = vec4(inVertex.x,inVertex.y,inVertex.z,1.0);
gl_Position = modelViewProjectionMatrix * position;

Can anyone help debug whats wrong or where to look for issues?