I have been reading about std140 Uniform block in OpenGL Superbible 6th edition, where in page 111 the following example is given :
layout(std140) uniform TransformBlock
{
//Member base alignment offset aligned offset
float scale ; // 4 0 0
vec3 translation; // 16 4 16
float rotation[3]; // 16 28 32 (rotation[0])
// 48 (rotation[1])
// 64 (rotation[2])
mat4 projection_matrix; // 16 80 80 (column 0)
// 96 (column 1)
// 112 (column 2)
// 128 (column 3)
}
I am having hard time understanding the alignments, even using the rules that have described earlier in that page, it still don't make sense.To be specific thing that confuses me is :
What is the Offset and what is aligned offset, why 2 different offset?
Why is the rotation[0] offset starts at 28, and why aligned offset is 32?
Hopefully someone can clear my confusions.I would highly appreciate. Thanks