What does the [] operator do when addressing an attribute vec4?
attribute vec4 a_MatrixWeights;
...
foo(float weight);
...
void main()
{
foo(a_MatrixWeights[0]);
foo(a_MatrixWeights[1]);
foo(a_MatrixWeights[2]);
foo(a_MatrixWeights[3]);
}
Is this addressing the individual fields of the vec4 (.x, .y, .z, .w) or is this somehow treating the vec4 and an array of vec4 and doing something else?
Yes it’s for accessing individual fields.
Also array subscripting can be use for accessing colums of matrices: