Given we are using OpenGL 4.5 or have support for the GL_ARB_direct_state_access
extension, we have the new function glCreateBuffers
.
This function has an identical signature to glGenBuffers
, but specifies:
returns
n
previously unused buffer names inbuffers
, each representing a new buffer object initialized as if it had been bound to an unspecified target
glGenBuffers
has the following specification:
Buffer object names returned by a call to
glGenBuffers
are not returned by subsequent calls, unless they are first deleted withglDeleteBuffers
.
So any buffer name returned by glCreateBuffers
will never be used again by itself, but could be used by glGenBuffers
.
It seems that glCreateBuffers
will always create new buffer objects and return their names, and glGenBuffers
will only create new buffers if there are no previous buffers that have since been deleted.
What advantage does adding this function have?
When should I use glCreateBuffers
over glGenBuffers
?
P.S.
I think this stands for all glCreate*
functions added by GL_ARB_direct_state_access
glGenBuffers
will never create new buffers. – TheoreticianglBindBuffer
, makes sense – BronchoglBindBuffer
, because "initialized as if it had been bound to an unspecified target" is not terribly useful. Probably there's some difference as what operations are allowed before callingglBindBuffer
. – TheoreticianglVertexArray*Buffer[s]
– Broncho