How Vertex Array Objects (VAO) encapsulate vertex attribute state in OpenGL 3.3+:
Instead of calling glVertexAttribPointer and glEnableVertexAttribArray before every draw call:
- Bind VAO (
glBindVertexArray(vao)). - Bind VBO and configure vertex layout (Position at location 0, Normal at location 1, UV at location 2).
- Unbind VAO.
During rendering, a single glBindVertexArray(vao) restores all vertex buffer bindings and attribute layouts in 1 state change before calling glDrawElements!