Layout (location = 1) in vec4 Attrib // inside Shader B Otherwise use two vertex arrays with the respective offset into the buffer (and other properties warranting separate vertex arrays), bind array A to index 0, array B to index 1 and use explicit attrib locations in your shaders like so (assuming some 4-component attribute): layout (location = 0) in vec4 Attrib // inside Shader A If you have the same buffer layout when sourcing vertex attribs with either shader, use a single vertex array and simply provide a starting offset with glDrawArrays(). I need half of its data to process with ShaderProgram A, and another half - with ShaderProgram B.Currently what I do is creating two different VAOs with vertex attribute pointers pointing to related parts of the vertex array.But in this case I must issue 2 draw calls -one per VAO.
The combination of one or more vertex arrays and an associated data store enables pulling of vertex attributes inside a shader (unless the corresponding arrays are disabled).
A data store plus some state is what makes up a vertex buffer object. Vertex arrays, in the sense of the spec, are merely descriptions of the layout of an associated data store. Vertex arrays are state of vertex array objects and even back in the day, when there were client side vertex arrays, they were not part of vertex buffer objects. I have a vertex buffer which has a regular vertex array.įirst of all, a vertex buffer does not have any arrays.