This question already has an answer here:
- What is the purpose of `glEnableVertexAttribArray(GLuint index)` in OpenGL? 2 answers
Using glVertexAttribPointer
the opengl implementation already knows to which attribute location/index in vertex shader Vertex Attribute Object is bound, so why is there the need to provide attribute index in glEnableVertexAttribArray
again? I think after using glBindVertexArray(VAO); it could have been enough to use just glEnableVertexAttribArray()
? Why there is the need to provide attribute index two times; one in glVertexAttribPointer
and one in glEnableVertexAttribArray()
?
Please bear with me, I am beginner and i don't know all aspects of the OpenGL yet.
[This question is NOT duplicate as some try to mark it as duplicate to redirect to their answers on some irrelevant questions to earn rating, this is selfish act! Please don't ruin the question by marking as duplicate if you don't know how to answer it.]