3 This file is part of gldbg
4 Copyright © 2009 Mikko Rasa, Mikkosoft Productions
5 Distributed under the GPL
8 #include <msp/strings/formatter.h>
9 #include "bufferstate.h"
15 BufferState::BufferState():
16 usage(GL_STATIC_DRAW),
21 void BufferState::set_data(unsigned sz, const void *ptr, GLenum use)
26 data = new char[size];
28 set_sub_data(0, size, ptr);
31 void BufferState::set_sub_data(unsigned off, unsigned sz, const void *ptr)
33 if(data && off+sz<size)
35 const char *cptr = reinterpret_cast<const char *>(ptr);
36 copy(cptr, cptr+sz, data+off);
40 string BufferState::describe() const
42 return format("%d bytes, %s", size, describe_enum(usage, ""));