]> git.tdb.fi Git - libs/gl.git/commitdiff
Buffer fixes in ProgramData
authorMikko Rasa <tdb@tdb.fi>
Sun, 26 Aug 2012 21:29:46 +0000 (00:29 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 26 Aug 2012 21:29:46 +0000 (00:29 +0300)
Set proper usage hint, and delete the buffer in the destructor.

source/programdata.cpp

index 7334596c0d4873cfb550b995e5791d8b5236cd2d..f3f498f3e948966d9e1dd3524175b1d0ddc5060e 100644 (file)
@@ -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;