Closed nnooney closed 10 years ago
Hi, you can use for example:
oglplus::Buffer buf;
buf.Bind(Buffer::Target::Array);
Buffer::Data<GLfloat>(Buffer::Target::Array, size, nullptr);
which translates to
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat)*size, NULL, GL_STATIC_DRAW);
That works perfectly! Thank you very much.
Since I know the number of bytes I want the Buffer to be, I used:
Buffer::Data<GLbyte>(Buffer::Target::Array, size, nullptr);
I've also added a new function called Resize
to Buffer
so you can rewrite your code in the following way:
Buffer::Resize(BufferTarget::Array, BufferSize::Of<GLbyte>(size));
Hi,
I want to allocate storage space in a buffer without filling it with data, so that I can later map it with oglplus::BufferRawMap and fill parts of it with data.
In the OpenGL documentation, I can do this by setting the argument data to NULL in the call to glBufferData(). Looking through the oglplus documentation, I see that the calls to oglplus::Buffer.Data() all require some data to initialize the buffer.
Is there a way to allocate a buffer without also filling it with data?