VAO being Vertex Array Object and VBO being Vertex Buffer Object. The calls for creating and binding/unbinding VAOs and VBOs have a general format as given below:
GLuint VAO, VBO;
glGenVertexArrays(1, &VAO);
glBindVertexArray(VAO);
glGenBuffers(1, &VBO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER,
sizeof(GLfloat)* 9,
vertices,
GL_STATIC_DRAW);
glVertexAttribPointer(0,
3, GL_FLOAT, GL_FALSE,
0, 0);
glEnableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
I've followed some tutorials on the internet, and they say that the VBO is bound to the VAO, but in the above code, I don't get how the "connection" or "binding" is established between the VBO and the VAO? I mean how do we know which VBO is bound to which VAO and what if a VBO is to be bound to multiple VAOs?
So, the basic question is: what does VBO is bound to VAO mean, how do we know which VBO is bound to which VAO and how is this binding established?