#ifndef MSP_GL_BUFFER_H_
#define MSP_GL_BUFFER_H_
-#include "types.h"
+#include "gl.h"
namespace Msp {
namespace GL {
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);
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