Direct State AccessGL 4.5
glVertexArrayAttribBinding
Says which buffer binding slot an attribute reads from.
Signature
void glVertexArrayAttribBinding(GLuint vaobj, GLuint attribindex, GLuint bindingindex);
How it works
The link between the two halves of the DSA vertex setup: attribute attribindex (format from glVertexArrayAttribFormat) takes its data from slot bindingindex (buffer from glVertexArrayVertexBuffer). Interleaved vertices put all attributes on slot 0.
Parameters
vaobjGLuint
The VAO.
attribindexGLuint
Attribute location.
bindingindexGLuint
Buffer binding slot.
Tips & pitfalls
Direct State Access (GL 4.5): the object is passed as a parameter, so nothing needs to be bound and no global state is disturbed.
Example
example.cpp
1glVertexArrayAttribBinding(vao, 0, 0);
2glVertexArrayAttribBinding(vao, 1, 0);