+ static bool set_current(BufferType, const Buffer *);
+};
+
+
+/**
+A proxy for a subset of a buffer. Can be bound for use with uniform blocks.
+*/
+class BufferRange
+{
+private:
+ Buffer &buffer;
+ unsigned offset;
+ unsigned size;
+
+ static std::vector<const BufferRange *> bound_uniform;
+
+public:
+ BufferRange(Buffer &, unsigned, unsigned);
+ ~BufferRange();
+
+ void data(const void *);
+
+ void bind_to(BufferType, unsigned);
+
+ static const BufferRange *current(BufferType t, unsigned i) { return binding(t, i); }
+ static void unbind_from(BufferType, unsigned);
+private:
+ static const BufferRange *&binding(BufferType, unsigned);
+ static bool set_current(BufferType, unsigned, const BufferRange *);
+
+public:
+ static unsigned get_n_uniform_buffer_bindings();
+ static unsigned get_uniform_buffer_alignment();