To clarify a bit, I’m talking about the following scenario:
- You have a VBO with all of the vertex data interlaced within it (a,b,c,d,a,b,c,d,…)
- Your shader program uses attributes a, b, and c.
- Your shader program does NOT use attribute d.
- You call glBindAttribLocation on your program for attributes a-d, giving them indices 0-3, in order.
- You link the shader.
- You set up a VAO, and in doing so, you enable set the pointers correctly for attributes 0-3, and you also enable attribute arrays 0-3.
The questions I have concern steps 4 and 6.
First question: Does attempting to bind an attribute location for an attribute that the shader doesn’t use have any negative consequences?
Second question: will enabling a vertex attribute array for an attribute that your shader doesn’t use cause any problems? For instance, will there be an error? Will there be a performance penalty for doing so?
I’ve tried doing both of these things, and at least with the drivers I’m using, it works fine. I wasn’t able to glean any information from the spec about what happens in these cases, so I’m hoping that someone here will have some information.