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. – Ben VoigtglBindBuffer
, makes sense – RamblingMadglBindBuffer
, 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
. – Ben VoigtglVertexArray*Buffer[s]
– RamblingMad