From 7c1559dec950966d9c45e0b5db6685a9c6a324ce Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 27 Aug 2012 00:29:46 +0300 Subject: [PATCH] Buffer fixes in ProgramData Set proper usage hint, and delete the buffer in the destructor. --- source/programdata.cpp | 4 ++++ 1 file changed, 4 insertions(+) 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; -- 2.45.2