Commit 5c0f2f8e authored by Vladislav Vinogradov's avatar Vladislav Vinogradov

reused buffer in GlTexture::copyFrom(GpuMat)

parent 212ceb3e
...@@ -157,6 +157,7 @@ namespace cv ...@@ -157,6 +157,7 @@ namespace cv
int type_; int type_;
Ptr<Impl> impl_; Ptr<Impl> impl_;
GlBuffer buf_;
}; };
template <> CV_EXPORTS void Ptr<GlTexture::Impl>::delete_obj(); template <> CV_EXPORTS void Ptr<GlTexture::Impl>::delete_obj();
......
...@@ -915,7 +915,7 @@ inline void cv::GlTexture::Impl::unbind() const ...@@ -915,7 +915,7 @@ inline void cv::GlTexture::Impl::unbind() const
#endif // HAVE_OPENGL #endif // HAVE_OPENGL
cv::GlTexture::GlTexture() : rows_(0), cols_(0), type_(0) cv::GlTexture::GlTexture() : rows_(0), cols_(0), type_(0), buf_(GlBuffer::TEXTURE_BUFFER)
{ {
#ifndef HAVE_OPENGL #ifndef HAVE_OPENGL
throw_nogl; throw_nogl;
...@@ -924,7 +924,7 @@ cv::GlTexture::GlTexture() : rows_(0), cols_(0), type_(0) ...@@ -924,7 +924,7 @@ cv::GlTexture::GlTexture() : rows_(0), cols_(0), type_(0)
#endif #endif
} }
cv::GlTexture::GlTexture(int rows, int cols, int type) : rows_(0), cols_(0), type_(0) cv::GlTexture::GlTexture(int rows, int cols, int type) : rows_(0), cols_(0), type_(0), buf_(GlBuffer::TEXTURE_BUFFER)
{ {
#ifndef HAVE_OPENGL #ifndef HAVE_OPENGL
(void)rows; (void)rows;
...@@ -939,7 +939,7 @@ cv::GlTexture::GlTexture(int rows, int cols, int type) : rows_(0), cols_(0), typ ...@@ -939,7 +939,7 @@ cv::GlTexture::GlTexture(int rows, int cols, int type) : rows_(0), cols_(0), typ
#endif #endif
} }
cv::GlTexture::GlTexture(Size size, int type) : rows_(0), cols_(0), type_(0) cv::GlTexture::GlTexture(Size size, int type) : rows_(0), cols_(0), type_(0), buf_(GlBuffer::TEXTURE_BUFFER)
{ {
#ifndef HAVE_OPENGL #ifndef HAVE_OPENGL
(void)size; (void)size;
...@@ -953,7 +953,7 @@ cv::GlTexture::GlTexture(Size size, int type) : rows_(0), cols_(0), type_(0) ...@@ -953,7 +953,7 @@ cv::GlTexture::GlTexture(Size size, int type) : rows_(0), cols_(0), type_(0)
#endif #endif
} }
cv::GlTexture::GlTexture(InputArray mat_, bool bgra) : rows_(0), cols_(0), type_(0) cv::GlTexture::GlTexture(InputArray mat_, bool bgra) : rows_(0), cols_(0), type_(0), buf_(GlBuffer::TEXTURE_BUFFER)
{ {
#ifndef HAVE_OPENGL #ifndef HAVE_OPENGL
(void)mat_; (void)mat_;
...@@ -1058,8 +1058,8 @@ void cv::GlTexture::copyFrom(InputArray mat_, bool bgra) ...@@ -1058,8 +1058,8 @@ void cv::GlTexture::copyFrom(InputArray mat_, bool bgra)
throw_nocuda; throw_nocuda;
#else #else
GpuMat d_mat = mat_.getGpuMat(); GpuMat d_mat = mat_.getGpuMat();
GlBuffer buf(d_mat, GlBuffer::TEXTURE_BUFFER); buf_.copyFrom(d_mat);
impl_->copyFrom(buf, bgra); impl_->copyFrom(buf_, bgra);
#endif #endif
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment