How do I supply a buffer with a size but no data in OpenGL? I've tried using
glBufferData(target, 0, nullptr, GL_STATIC_DRAW);
but for now I get access violations on drawcall, might be something else.
Is this the right way to do it?
How do I supply a buffer with a size but no data in OpenGL?
You've to pass a certain size (in bytes) to the size
parameter, but pass nullptr
to data
. See glBufferData
:
GLsizeiptr size_in_bytes = ...;
glBufferData(target, size_in_bytes, nullptr, GL_STATIC_DRAW);