Merge pull request #1825 from jet47:fix-opengl-mem-leak

pull/1823/merge
Roman Donchenko 11 years ago committed by OpenCV Buildbot
commit 56f791679b
  1. 3
      modules/core/src/opengl_interop.cpp

@ -1022,6 +1022,7 @@ cv::ogl::Texture2D::Texture2D(InputArray arr, bool autoRelease) : rows_(0), cols
#else
GpuMat dmat = arr.getGpuMat();
ogl::Buffer buf(dmat, ogl::Buffer::PIXEL_UNPACK_BUFFER);
buf.setAutoRelease(true);
buf.bind(ogl::Buffer::PIXEL_UNPACK_BUFFER);
impl_ = new Impl(internalFormats[cn], asize.width, asize.height, srcFormats[cn], gl_types[depth], 0, autoRelease);
ogl::Buffer::unbind(ogl::Buffer::PIXEL_UNPACK_BUFFER);
@ -1135,6 +1136,7 @@ void cv::ogl::Texture2D::copyFrom(InputArray arr, bool autoRelease)
#else
GpuMat dmat = arr.getGpuMat();
ogl::Buffer buf(dmat, ogl::Buffer::PIXEL_UNPACK_BUFFER);
buf.setAutoRelease(true);
buf.bind(ogl::Buffer::PIXEL_UNPACK_BUFFER);
impl_->copyFrom(asize.width, asize.height, srcFormats[cn], gl_types[depth], 0);
ogl::Buffer::unbind(ogl::Buffer::PIXEL_UNPACK_BUFFER);
@ -1185,6 +1187,7 @@ void cv::ogl::Texture2D::copyTo(OutputArray arr, int ddepth, bool autoRelease) c
throw_nocuda();
#else
ogl::Buffer buf(rows_, cols_, CV_MAKE_TYPE(ddepth, cn), ogl::Buffer::PIXEL_PACK_BUFFER);
buf.setAutoRelease(true);
buf.bind(ogl::Buffer::PIXEL_PACK_BUFFER);
impl_->copyTo(dstFormat, gl_types[ddepth], 0);
ogl::Buffer::unbind(ogl::Buffer::PIXEL_PACK_BUFFER);

Loading…
Cancel
Save