prevent persistance buffer leak

This commit is contained in:
Julien Valentin 2019-12-26 22:57:13 +01:00
parent 30e749ae54
commit e605d6aa3d

View File

@ -228,7 +228,6 @@ void GLBufferObject::compileBuffer()
} }
_persistantDMA = _extensions->glMapBufferRange( _profile._target, 0, _profile._size, _profile._usage); _persistantDMA = _extensions->glMapBufferRange( _profile._target, 0, _profile._size, _profile._usage);
} }
} }
else else
{ {
@ -313,6 +312,14 @@ void GLBufferObject::deleteGLObject()
OSG_DEBUG<<"GLBufferObject::deleteGLObject() "<<_glObjectID<<std::endl; OSG_DEBUG<<"GLBufferObject::deleteGLObject() "<<_glObjectID<<std::endl;
if (_glObjectID!=0) if (_glObjectID!=0)
{ {
if(_persistantDMA)
{
_extensions->glBindBuffer(_profile._target, _glObjectID);
_extensions->glUnmapBuffer(_profile._target);
_persistantDMA = 0;
_extensions->glBindBuffer(_profile._target, 0);
}
_extensions->glDeleteBuffers(1, &_glObjectID); _extensions->glDeleteBuffers(1, &_glObjectID);
_glObjectID = 0; _glObjectID = 0;