This is a wrapper around a GLuint generated by glGenBuffers(1, &id).
Initially, this id is 0.
glGenBuffers is automatically called the first time bind() is called.
Vbo!void is an alias of this.
const @property GLuint id();
The id of this Vao, or 0 if it is not yet created in OpenGL.
Allocate a OpenGL Vbo with space for n elements. (Calls glBufferData with null.)
The contents of the Vbo are uninitialized and thus undefined.
size_t size();
The number of elements stored in this Vbo. (Calls glGetBufferParameteriv with GL_BUFFER_SIZE.)
void clear(GLenum usage = GL_STATIC_DRAW);
Calls resize(0).
auto mapReadOnly();
auto mapWriteOnly();
auto mapReadWrite();
Map the contents of the Vbo in our own memory, temporarily. (Calls glMapBuffer.)
Returns:
An object that behaves like a T[] (or const(T)[], for the read-only version),
and reflects the contents of the Vbo.
After this object is destructed, slices in that piece of memory are no longer valid
(because glUnmapBuffer is then called).
Examples:
auto v = Vbo!int(3);
{
auto m = v.mapWriteOnly();
m[] = 5;
m[1] = 2;
}
assert(v.mapReadOnly()[] == [5, 2, 5]);
template Vbo(T)
An alias for SpecificVbo!T, except that Vbo!void is an alias for GenericVbo.