X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fbuffer.h;h=7aea9665d8dd9a2ddaf77695891aa7c840a0810c;hb=85c82f93f4874bcf0b04332c9abb62cd2a5b181b;hp=7e57cf029581d6c6740119865d1e1ad761cc3832;hpb=ceae2a27dfc58310c5bab7e3aa3fedf0fa9a1f49;p=libs%2Fgl.git diff --git a/source/buffer.h b/source/buffer.h index 7e57cf02..7aea9665 100644 --- a/source/buffer.h +++ b/source/buffer.h @@ -52,19 +52,10 @@ public: Buffer(BufferType); ~Buffer(); - /** Binds the buffer in its default slot. */ - void bind() const { bind(type); } - - /** Binds the buffer in an alternate slot. */ - void bind(BufferType) const; - private: - void maybe_bind() const; + const Buffer *maybe_bind() const; public: - /** Unbinds the buffer from its default slot. */ - void unbind() const { unbind(type); } - /** Sets the usage hint of the buffer. It will take effect the next time the buffer's contents are defined. */ void set_usage(BufferUsage); @@ -77,9 +68,20 @@ public: not be changed with this call. */ void sub_data(unsigned, unsigned, const void *); - static void unbind(BufferType); + /** Binds the buffer in its default slot. */ + void bind() const { bind_to(type); } + + /** Binds the buffer in an alternate slot. */ + void bind_to(BufferType) const; + + /** Unbinds the buffer from its default slot. */ + void unbind() const { unbind_from(type); } + + static const Buffer *current(BufferType t) { return binding(t); } + static void unbind_from(BufferType); private: static const Buffer *&binding(BufferType); + static void restore(const Buffer *, BufferType); }; } // namespace GL