From: Mikko Rasa Date: Sun, 26 Aug 2012 21:29:46 +0000 (+0300) Subject: Buffer fixes in ProgramData X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=7c1559dec950966d9c45e0b5db6685a9c6a324ce;p=libs%2Fgl.git Buffer fixes in ProgramData Set proper usage hint, and delete the buffer in the destructor. --- diff --git a/source/programdata.cpp b/source/programdata.cpp index 7334596c..f3f498f3 100644 --- a/source/programdata.cpp +++ b/source/programdata.cpp @@ -39,6 +39,7 @@ ProgramData::~ProgramData() 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) @@ -171,7 +172,10 @@ UniformBlock *ProgramData::create_block(const Program::UniformBlockInfo &info) c { 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;