Suppose I have 2 different objects, each one has its own VAO and draw call. Something like this:
void Object::Draw() {
glBindVertexArray(vao);
glDrawArrays(GL_TRIANGLES, foo, bar);
}
First I call the first object's draw call which binds its VAO and renders it. Then, I do the same thing for the second object.
I know this will work and both objects will be rendered. My question is why. What happens in OpenGL's state when I bind a VAO without unbinding any other previously bound VAOs?
Override.
If the bind is successful no change is made to the state of the vertex array object, and any previous vertex array object binding is broken.
https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glBindVertexArray.xhtml