glNamedBufferData
glBufferData without binding: (re)allocates a buffer's storage by ID.
Signature
void glNamedBufferData(GLuint buffer, GLsizeiptr size, const void *data, GLenum usage);
How it works
The same job as glBufferData: throw away the buffer's old storage, allocate size bytes and optionally copy data in. The difference is only how the buffer is named: by ID, so nothing has to be bound to GL_ARRAY_BUFFER first.
Calling it again with the same size and nullptr is the classic way to "orphan" a buffer each frame: the GPU keeps reading the old memory while you fill the new one.
Parameters
The buffer to allocate.
Size in bytes.
Initial data or nullptr.
GL_STATIC_DRAW, GL_DYNAMIC_DRAW, GL_STREAM_DRAW… (same as glBufferData).
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.
If the size never changes, prefer
glNamedBufferStorage.
Example
1glNamedBufferData(vbo, sizeof(vertices), vertices, GL_STATIC_DRAW);