How to query the value of a uniform block element?

I can’t use glGetUniform as uniform blocks don’t have locations, and glGetActiveUniformBlock cannot be used to query an element’s value. So how do I do it?

Also, is someone else having problems with using arrays in uniform blocks? Is this even supported? I’d like to store bone matrices for skinning in a uniform block but the data is not uploaded properly.

uniform Animation
	mat4 boneMatrices[64];
} animation;

Thank you!



The specification (GLSL 3.3) explicitly states that arrays are allowed in uniform blocks. However, there is a limit on how many uniforms you can have, or rather how much memory they can consume. This varies between implementations. 64 matrices would consume 4 kilobytes, which is quite a lot.

Uniform block elements don’t have values. The whole point of a uniform block is that its values come from a buffer object. Therefore, what Ilian Dinev said is correct: read your buffer object.

ok that makes sense, thank you all! i’ll try mapping the buffer.