TexturesGL 1.1
glDeleteTextures
Frees textures and their GPU memory; the names can be reused.
Part of the family glDelete*
Signature
void glDeleteTextures(GLsizei n, const GLuint *textures);
How it works
The counterpart of glGenTextures and glCreateTextures. Textures are usually the biggest users of video memory, so delete the ones you no longer need (when a level unloads, or at shutdown).
A deleted texture that is still bound reverts that binding to 0, and one attached to the currently bound framebuffer is detached from it.
Parameters
nGLsizei
How many.
texturesconst GLuint *
The names; 0 and unknown names are silently ignored.
Tips & pitfalls
Set your variable to 0 after deleting, so a later use is an obvious bug instead of reading a recycled name.
Errors
When the call is invalid it does nothing and sets an error, which glGetError returns:
- GL_INVALID_VALUE
- n is negative.
Example
example.cpp
1glDeleteTextures(1, &texture);
2texture = 0;