Function familiesfamily

glDelete*

Free objects and their GPU memory; 0 and unknown names are ignored.

Signature

void glDelete{Buffers|VertexArrays|Textures|Framebuffers|Renderbuffers|Queries}(GLsizei n, const GLuint *ids);
void glDeleteShader(GLuint shader);
void glDeleteProgram(GLuint program);
void glDeleteSync(GLsync sync);

How it works

A GLuint does not free its object by itself: forget glDelete* and the GPU memory stays used until the context is destroyed. Each object should have one owner in your code that deletes it once.

Set the variable to 0 after deleting. glDelete* ignores 0, so a second delete is harmless, and any later use is an obvious bug instead of touching a recycled name that now belongs to another object.

Reading the name

Buffers, Textures…
Plural, with n and an array, mirroring glGen* / glCreate*.
Shader, Program, Sync
Singular: one object per call.

Functions in this family

Example

example.cpp
1glDeleteVertexArrays(1, &vao);
2glDeleteBuffers(1, &vbo);
3glDeleteProgram(program);
4vao = vbo = program = 0;