Vertex array object (VAO)
A Vertex Array Object (VAO) is an OpenGL object that stores all of the state needed to supply vertex data. It stores the format of the vertex data as well as the buffers objects providing the vertex data arrays.
In other words, VAO stores vertex bindings that are performed by functions like glVertexAttribPointer(). So you don't need a binding every time when rendering frame. Instead you specify which vao OpenGL should use.
VAOs do not copy, freeze or store the contents of the referenced buffers - if you change any of the data in the buffers referenced by an existing VAO, those changes will be seen by users of the VAO.
You can use VAO as extension in OpenGL 2.0. Since v3.0 it is included to the core.
idVao = glGenVertexArrays() glBindVertexArray(idVao) // create vbo with bindings // .... glBindVertexArray(0) // draw vao glBindVertexArray(idVao) glDrawArrays(GL_TRIANGLE_STRIP, 0, vertexCount) // delete glDeleteVertexArrays(idVao)
You can download full sources of colored quad on GitHub.