GL_OES_mapbuffer¶
Supported Hardware¶
Series5, Series5XT, Series6, Series6XE, Series6XT
Valid APIs¶
OpenGL ES 1.x, 2.0
Description¶
This extension enables the user to upload data directly into memory that the driver provides for them, by mapping the storage of a buffer object into client address space. In many cases this means that the user can avoid an additional memory allocation on top of one performed by the driver.
Note¶
This functionality is core to OpenGL ES 3.0 in the form of glMapBufferRange
Registry Link¶
http://www.khronos.org/registry/gles/extensions/OES/OES_mapbuffer.txt
Example¶
// Bind a buffer
glBindBuffer(GL_ARRAY_BUFFER, aVertexBuffer);
// Map the buffer's data to a CPU addressable pointer, in a way that allows us to write to it,
// but not read the data back.
void* bufferData = glMapBufferOES(GL_ARRAY_BUFFER, GL_WRITE_ONLY_OES);
// Get the size of the buffer
GLint bufferSize = 0;
glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &bufferSize);
// Write some data into the pointer
memcpy(bufferData, newDataForTheBuffer, bufferSize);
// Unmap the pointer
glUnmapBufferOES(GL_ARRAY_BUFFER);
// The pointer is now invalid, so NULL it
bufferData = NULL;