reused buffer in GlTexture::copyFrom(GpuMat)
authorVladislav Vinogradov <no@email>
Mon, 27 Feb 2012 13:22:41 +0000 (13:22 +0000)
committerVladislav Vinogradov <no@email>
Mon, 27 Feb 2012 13:22:41 +0000 (13:22 +0000)
modules/core/include/opencv2/core/opengl_interop.hpp
modules/core/src/opengl_interop.cpp

index 7b0f088..338466b 100644 (file)
@@ -157,6 +157,7 @@ namespace cv
         int type_;\r
 \r
         Ptr<Impl> impl_;\r
+        GlBuffer buf_;\r
     };\r
 \r
     template <> CV_EXPORTS void Ptr<GlTexture::Impl>::delete_obj();\r
index e478c69..a9c7819 100644 (file)
@@ -915,7 +915,7 @@ inline void cv::GlTexture::Impl::unbind() const
 \r
 #endif // HAVE_OPENGL\r
 \r
-cv::GlTexture::GlTexture() : rows_(0), cols_(0), type_(0)\r
+cv::GlTexture::GlTexture() : rows_(0), cols_(0), type_(0), buf_(GlBuffer::TEXTURE_BUFFER)\r
 {\r
 #ifndef HAVE_OPENGL\r
     throw_nogl;\r
@@ -924,7 +924,7 @@ cv::GlTexture::GlTexture() : rows_(0), cols_(0), type_(0)
 #endif\r
 }\r
 \r
-cv::GlTexture::GlTexture(int rows, int cols, int type) : rows_(0), cols_(0), type_(0)\r
+cv::GlTexture::GlTexture(int rows, int cols, int type) : rows_(0), cols_(0), type_(0), buf_(GlBuffer::TEXTURE_BUFFER)\r
 {\r
 #ifndef HAVE_OPENGL\r
        (void)rows;\r
@@ -939,7 +939,7 @@ cv::GlTexture::GlTexture(int rows, int cols, int type) : rows_(0), cols_(0), typ
 #endif\r
 }\r
 \r
-cv::GlTexture::GlTexture(Size size, int type) : rows_(0), cols_(0), type_(0)\r
+cv::GlTexture::GlTexture(Size size, int type) : rows_(0), cols_(0), type_(0), buf_(GlBuffer::TEXTURE_BUFFER)\r
 {\r
 #ifndef HAVE_OPENGL\r
        (void)size;\r
@@ -953,7 +953,7 @@ cv::GlTexture::GlTexture(Size size, int type) : rows_(0), cols_(0), type_(0)
 #endif\r
 }\r
 \r
-cv::GlTexture::GlTexture(InputArray mat_, bool bgra) : rows_(0), cols_(0), type_(0)\r
+cv::GlTexture::GlTexture(InputArray mat_, bool bgra) : rows_(0), cols_(0), type_(0), buf_(GlBuffer::TEXTURE_BUFFER)\r
 {\r
 #ifndef HAVE_OPENGL\r
        (void)mat_;\r
@@ -1058,8 +1058,8 @@ void cv::GlTexture::copyFrom(InputArray mat_, bool bgra)
                 throw_nocuda;\r
             #else\r
                 GpuMat d_mat = mat_.getGpuMat();\r
-                GlBuffer buf(d_mat, GlBuffer::TEXTURE_BUFFER);\r
-                impl_->copyFrom(buf, bgra);\r
+                buf_.copyFrom(d_mat);\r
+                impl_->copyFrom(buf_, bgra);\r
             #endif\r
 \r
             break;\r