layout(std140) uniform SkeletonBlock { vec3 position[64]; vec4 orientation[64]; } Skeleton;
Here's how this definition reads:
- There is a single block called
SkeletonBlock . - It contains an array of 64
vec3 called position , followed by an array of 64 vec4 called orientation . - The name for all its members is qualified in GLSL with the
Skeleton identifier.
Pay attention to the last part. In GLSL and only in GLSL, the position array is identified by Skeleton.position . In C ++, an array is identified by either SkeletonBlock.position or SkeletonBlock.position[0] . The thing is, from C ++ code, you use the SkeletonBlock block name as a prefix, not the Skeleton instance name.
The SkeletonBlock block has an index that can be requested using glGetUniformBlockIndex (note the use of the word "Block" and the lack of multiplicity in the "Index"). Individual uniform members also have indexes, but they are indexes on the uniform list. And these variables must be named correctly. If a single block has an instance name, then single block members must have a block name prefix, not an instance name.
If you pass these names to the OpenGL function and don't get valid indexes, then you probably have a driver error.
source share