Using a Buffer Subregion
Completing the functionality needed to reuse allocated buffers is the ability to use an arbitrary subregion of a texture, VBO, or surface:
glDrawArrays(enum mode, int first, sizei count)
glReadPixels(int x, int y, sizei width, sizei height, enum format, enum type, void *data)
glCopyTexImage2D(enum target, int level, int x, int y, sizei width, sizei height)
glCopyTexSubImage2D(enum target, int level, int xoffset, int yoffset, int x, int y, sizei width, sizei height)
For VBOs, the glDrawArrays
function allows the application to choose a contiguous subset of a VBO.
For textures, there's no explicit call to limit texturing source to a particular subregion. But texture coordinates and wrapping modes can be specified in order to render an arbitrary subregion of texture object.
For surfaces, the glReadPixels
function can be used to read from a subregion of a display, when copying data back to an application-allocated buffer.
The glCopyTexImage2D
and glCopyTexSubImage2D
functions also restrict themselves to copying from a subregion of the display surface when transferring data to a texture map. The only area that's problematic is controlling the direct display of window surface back buffer. OpenGL ES and EGL have no way to show only a subregion of the backbuffer surface, but the native windowing systems may have this functionality.