Direct State AccessGL 4.5

glCreateBuffers

Creates buffer objects that exist immediately — no bind needed.

Part of the family glCreate*

Signature

void glCreateBuffers(GLsizei n, GLuint *buffers);

How it works

The DSA replacement for glGenBuffers. glGen only reserves a name and the object appears at the first bind; glCreate creates the real object right away, so it can be passed straight to glNamedBuffer* functions.

Parameters

nGLsizei

How many buffers.

buffersGLuint *

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 vbo;
2glCreateBuffers(1, &vbo);
3glNamedBufferStorage(vbo, sizeof(vertices), vertices, 0);
Official Khronos documentation