0

I'm looking at implementing Vertex Array Objects, and I'm a little bit confused about the relationship between the terminology of Vertex Array and Attribute.

Is there such a thing as a Vertex Array which affects something other than the attributes?

Similarly - is there such a thing as a Buffer (in the sense of gl.bufferData) which affects something other than the attributes?

At a glance, it seems to me a little bit like Vertex Array, Buffer, and Attribute are all describing the same thing, and the terminology is something to do more about how they are organized in the pipeline?

Perhaps it's made a little bit more confusing where the names get mixed together in different api calls too - e.g. vertexAttribPointer

davidkomer
  • 3,020
  • 2
  • 23
  • 58
  • 1
    Just incase the other answer wasn't clear "Buffer" is a binary hunk of data on the GPU. "Attribute" has 2 parts. The GLSL shader part and the WebGL state part. In GLSL you define an attribute, eg 'attribute vec4 position`. In WebGL you then look up the location of that attribute and setup the attribute at that location to tell WebGL which buffer to use to provide data for that GLSL attribute and how to pull the data out of the buffer (type, size, stride, offset, etc). "Vertex Array" = the collection of all attributes + the element array binding. – gman Mar 30 '18 at 00:59
  • Thanks, that's very helpful! I think that clears up all my questions... Just to think out loud- it's a _little_ confusing that attribute locations may be derived manually outside of the shader (though to be useful they must be bound to the shader), while uniform locations are gotten from the shader and may not be determined otherwise. In other words attributes seem like they can be re-used between shaders (because in the sense of them being buffers, and re-using numbers via manually assigning them, they can)- while uniforms are strictly per-shader? – davidkomer Mar 30 '18 at 06:21

0 Answers0