+UniformBlock::UniformBlock():
+ buf_range(0)
+{ }
+
+UniformBlock::UniformBlock(unsigned s):
+ size(s),
+ data(size),
+ buf_range(0)
+{ }
+
+UniformBlock::~UniformBlock()
+{
+ delete buf_range;
+}
+
+unsigned UniformBlock::get_alignment() const
+{
+ return BufferRange::get_uniform_buffer_alignment();
+}
+
+void UniformBlock::offset_changed()
+{
+ delete buf_range;
+ buf_range = 0;
+}
+
+void UniformBlock::upload_data() const
+{
+ if(!buf_range)
+ buf_range = new BufferRange(*get_buffer(), get_offset(), size);
+ buf_range->data(&data[0]);
+}
+