]> git.tdb.fi Git - libs/gl.git/blobdiff - source/buffer.h
Support different data types in Batch
[libs/gl.git] / source / buffer.h
index 7aea9665d8dd9a2ddaf77695891aa7c840a0810c..1d073ab7af35c77ae32a43068c71a79ecd21831f 100644 (file)
@@ -1,7 +1,7 @@
 /* $Id$
 
 This file is part of libmspgl
-Copyright © 2007  Mikko Rasa, Mikkosoft Productions
+Copyright © 2007, 2009-2010  Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
 
@@ -84,6 +84,23 @@ private:
        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