-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2007 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
#ifndef MSP_GL_BUFFER_H_
#define MSP_GL_BUFFER_H_
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); }
static void restore(const Buffer *, BufferType);
};
+/**
+An adaptor for Buffer to make it compatible with Bind.
+*/
+template<BufferType T>
+class BufferAlias
+{
+private:
+ const Buffer &buffer;
+
+public:
+ BufferAlias(const Buffer &b): buffer(b) { }
+
+ void bind() const { buffer.bind_to(T); }
+ static const Buffer *current() { return Buffer::current(T); }
+ static void unbind() { Buffer::unbind_from(T); }
+};
+
} // namespace GL
} // namespace Msp