Set proper usage hint, and delete the buffer in the destructor.
delete i->second;
for(BlockMap::iterator i=blocks.begin(); i!=blocks.end(); ++i)
delete i->second.block;
+ delete buffer;
}
void ProgramData::uniform(const string &name, Uniform *uni)
{
UniformBlock *block = new UniformBlock(info.data_size);
if(!buffer)
+ {
buffer = new Buffer(UNIFORM_BUFFER);
+ buffer->set_usage(STREAM_DRAW);
+ }
block->use_buffer(buffer, last_block);
last_block = block;
return block;