When binding an attribute index using glVertexAttribPointer, what happens when an associated program does not contain an attribute at said index?
Is the behaviour undefined, or is the attribute ignored altogether?
I have searched the docs quite extensively, and have not been able to find much info about the link between programs and dynamic attribute bindings.
A program is not associated to a vertex array object. The vertex attribute index is the binding point. If a binding point is not "needed" by the program this doesn't cause any issue.
OpenGL 4.6 API Core Profile Specification - 10.2.1 Current Generic Attributes, page 349:
This means if the data type of the attribute is floating point, then you've to specify the array of vertex attribute data by
glVertexAttribPointer. If the data type is integral the you've to useglVertexAttribIPointer(focus on theI).If you ignore that, then the data in the vertex array buffer will be misinterpreted.
OpenGL 4.6 API Core Profile Specification - 10.3.5 Transferring Array Elements, page 361:
So the tuple size of the vertex data and the tuple size of the data type of the vertex attribute in the shader program (e.g.
float,vec2,vec3, ...) are allowed to be different.If the tuple size of the vertex attribute in the program is greater, then the data are expanded by 0 for the 2md and 3rd respectively 1 for the 4th component.
If the tuple size of the vertex attribute in the program is less, then the additional components in the vertex array are "not used".