Buffer::Buffer(BufferType t):
type(t),
- usage(STATIC_DRAW)
+ usage(STATIC_DRAW),
+ size(0)
{
static RequireExtension _req_vbo("GL_ARB_vertex_buffer_object");
if(type==PIXEL_PACK_BUFFER || type==PIXEL_UNPACK_BUFFER)
usage = u;
}
-void Buffer::data(unsigned size, const void *d)
+void Buffer::data(unsigned sz, const void *d)
{
const Buffer *old = current(type);
bind();
- glBufferDataARB(type, size, d, usage);
+ glBufferDataARB(type, sz, d, usage);
+ size = sz;
restore(old, type);
}
-void Buffer::sub_data(unsigned offset, unsigned size, const void *d)
+void Buffer::sub_data(unsigned off, unsigned sz, const void *d)
{
const Buffer *old = current(type);
bind();
- glBufferSubDataARB(type, offset, size, d);
+ glBufferSubDataARB(type, off, sz, d);
restore(old, type);
}
BufferType type;
BufferUsage usage;
unsigned id;
+ unsigned size;
static const Buffer *bound[4];
not be changed with this call. */
void sub_data(unsigned, unsigned, const void *);
+ unsigned get_size() const { return size; }
+
/** Binds the buffer in its default slot. */
void bind() const { bind_to(type); }