Function familiesfamily
glCreate*
Create objects that exist immediately, ready for DSA calls; shaders and programs are created this way too.
Signature
void glCreate{Buffers|VertexArrays|Textures|Framebuffers|Renderbuffers}(GLsizei n, GLuint *ids); GLuint glCreateShader(GLenum type); GLuint glCreateProgram(void);
How it works
The GL 4.5 versions of glGen* (same parameters) create the real object at once, so it can go straight into glNamedBufferStorage, glTextureStorage2D and the other DSA calls without ever being bound. glCreateTextures also takes the texture type, which glGenTextures could not know.
glCreateShader and glCreateProgram are older and different: they make one object and return its name. They are listed here because the name looks the same.
Reading the name
- Buffers, VertexArrays…
- Plural: n objects into an array, like glGen*.
- Shader, Program
- Singular: one object, returned as the result.
Functions in this family
glCreateBuffersCreates buffer objects that exist immediately — no bind needed.glCreateVertexArraysCreates VAOs that can be configured without binding them.glCreateTexturesCreates textures of a given type immediately — no bind needed.glCreateFramebuffersCreates framebuffer objects that exist immediately, ready for glNamedFramebuffer* calls.glCreateRenderbuffersCreates renderbuffer objects (images you render into but never sample) without binding.glCreateShaderCreates an empty shader object of a given stage.glCreateProgramCreates an empty program object, which will link shaders into one pipeline.
Example
example.cpp
1GLuint tex;
2glCreateTextures(GL_TEXTURE_2D, 1, &tex);
3glTextureStorage2D(tex, levels, GL_SRGB8_ALPHA8, w, h);