Direct State AccessGL 4.5
glCreateRenderbuffers
Creates renderbuffer objects (images you render into but never sample) without binding.
Part of the family glCreate*
Signature
void glCreateRenderbuffers(GLsizei n, GLuint *renderbuffers);
How it works
A renderbuffer is a framebuffer image that shaders cannot read. That makes it the natural home for a depth-stencil buffer you only need for testing. After creating it, give it storage with glNamedRenderbufferStorage.
Parameters
nGLsizei
How many.
renderbuffersGLuint *
Array receiving the IDs.
Tips & pitfalls
Direct State Access (GL 4.5): the object is passed as a parameter, so nothing needs to be bound and no global state is disturbed.
Example
example.cpp
1GLuint rbo;
2glCreateRenderbuffers(1, &rbo);
3glNamedRenderbufferStorage(rbo, GL_DEPTH24_STENCIL8, w, h);