Mostly right. If you declare the attribute as a vec4
in the shader, the components that are not present in your input array will be filled with y = 0, z = 0, w = 1.
You don't have to declare attributes as vec4
in the shader, though. If your attribute is really just a float, you can declare it with type float
in the shader. From the ES 2.0 spec:
The attribute qualifier can be used only with the data types float, vec2, vec3, vec4, mat2, mat3, and mat4.
Limits on how many attributes are supported are expressed in units of vec4
, and a float
attribute will use one of those attribute slots, just like a vec4
would. So if you need a bunch of float attributes, and run close to the supported limit of how many attributes are supported, it might be a good idea to start packing them into vectors. It would most likely be beneficial for performance anyway.