GL_OES_vertex_array_object#

Supported Hardware#

Series5, Series5XT, Series6, Series6XE, Series6XT

Valid APIs#

OpenGL ES 1.x, 2.0

Description#

This extension provides a level of encapsulation for bound vertex state such as that set by, for example ‘glVertexPointer’. With this extension, any modifications to the vertex array state will bind specifically to the bound VAO, rather than being bound directly to the context. Changing between bound VAOs will modify the vertex state to whatever was last set within the newly bound VAO. This allows users to quickly switch between various vertex states, allowing them to, for example, switch between different model objects with far fewer API calls than are traditionally needed. To maintain compatibility with the Core ES APIs, this extension employs a “default VAO”. What this means is that rather than the object name ‘0’ being a special “nothing bound” name as in most OpenGL objects, it is instead a fully usable VAO.

More specifically, vertex array objects all the state set by the following methods:

ES1: gl*Pointer(), glEnableClientState(), glBindBuffer()*
ES2: glVertexAttribPointer(), glEnableVertexAttribArray(), glBindBuffer()*
*VAOs only store the bound GL_ELEMENT_ARRAY_BUFFER. Any binding to GL_ARRAY_BUFFER or other
buffer types are separate and distinct from VAOs.

Note#

This functionality is core to OpenGL ES 3.0.

Example#

// Generate a vertex array object
GLuint vertexArray;
glGenVertexArraysOES(1, &vertexArray);
// Bind the vertex array object
glBindVertexArrayOES(vertexArray);
// Set some vertex attribute pointers
glVertexAttribPointer(0, 4, GL_FLOAT, GL_TRUE, 0, dataPointer);
// Rebind the default VAO
glBindVertexArrayOES(0);