Freeing buffers
A similar set of APIs free allocated video memory buffers, whether they are textures, VBOs, or surfaces:
glDeleteBuffers(sizei n, uint *buffers)
glDeleteTextures(sizei n const uint *textures)
eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
Note:
The glDeleteTextures
function works only if the texture object is greater than zero; the default texture can't be explicitly deleted (although it can be replaced with a texture containing one or two dimensions of zero, which accomplishes the same thing).
Conceptually, these calls can be thought of as malloc()
and free()
for VBOs and texture maps, respectively. The same techniques for avoiding fragmentation can also be applied.