else if(restart_index && restart_index<=max_index)
set_restart_index(0);
- Buffer *ibuf = get_buffer();
+ const Buffer *ibuf = get_buffer();
const void *data_ptr;
BindRestore _bind_ibuf(ibuf, ELEMENT_ARRAY_BUFFER);
if(ibuf)
private:
void unlink_from_buffer();
+public:
+ /** Returns the buffer in which the data is stored. */
+ const Buffer *get_buffer() const { return buffer; }
+
protected:
/** Returns the buffer in which the data is stored. */
- Buffer *get_buffer() const { return buffer; }
+ Buffer *get_mutable_buffer() const { return buffer; }
/** Returns the amount of data to be stored in the buffer, in bytes. */
virtual unsigned get_data_size() const = 0;
void UniformBlock::upload_data(char *target) const
{
if(!buf_range)
- buf_range = new BufferRange(*get_buffer(), get_offset(), size);
+ buf_range = new BufferRange(*get_mutable_buffer(), get_offset(), size);
if(target)
copy(data.begin(), data.end(), target);
if(!set_current(this) && !dirty)
return;
- Buffer *vbuf = get_buffer();
+ const Buffer *vbuf = get_buffer();
Bind _bind_vbuf(vbuf, ARRAY_BUFFER);
if(vbuf && dirty)
update_buffer();