How does 'glVertexAttribPointer' bind to a buffer object
I am new to OpenGL and this might be a very basic question which is little confusing.
I am using opengles-book.com by aftab munshi to learn the basics and its going well except for one thing on page 123.
How do you bind the buffer object to point to the shader indices using glVertexAttribPointer. I am guessing you need to bind the buffer before you use the glVertexAttribPointer and the last parameter will point to the buffer object instead of the client memory.
But in the text book i am referring
glVertexAttribPointer(VERTEX_POS_INDX, VERTEX_POS_SIZE, GL_FLOAT, GL_FALSE, vtxStrides, 0);
glVertexAttribPointer(VERTEX_NORMAL_INDX, VERTEX_NORMAL_SIZE, GL_FLOAT, GL_FALSE, vtxStrides, 0);
glVertexAttribPointer(VERTEX_TEXCOORD0_INDX, VERTEX_TEXCOORD0_SIZE, GL_FLOAT, GL_FALSE, vtxStrides, 0);
because the last buffer binded is the vboIds all the 3 glVertexAttribPointer points to this last buffer ??? Isn't that wrong ?
Or does this mean something
Is this binding the buffer object to the the shader indices ? I know what glEnableVertexAttribArray means but does it also bind the buffer to the indices ?
All three buffers are inside the same VAO context (specified by a call to glBindVertexArray somewhere else), the _INDX arguments refer to the index inside the current VAO that a buffer is being piped into.