Commit b689eca8 authored by Vladislav Vinogradov's avatar Vladislav Vinogradov

fixed OpenGL tests

now create window only once per test case
parent aabc33c7
...@@ -106,10 +106,10 @@ public: ...@@ -106,10 +106,10 @@ public:
void copyFrom(InputArray arr, Target target = ARRAY_BUFFER, bool autoRelease = false); void copyFrom(InputArray arr, Target target = ARRAY_BUFFER, bool autoRelease = false);
//! copy to host/device memory //! copy to host/device memory
void copyTo(OutputArray arr, Target target = ARRAY_BUFFER) const; void copyTo(OutputArray arr, Target target = ARRAY_BUFFER, bool autoRelease = false) const;
//! create copy of current buffer //! create copy of current buffer
GlBuffer clone(Target target = ARRAY_BUFFER) const; GlBuffer clone(Target target = ARRAY_BUFFER, bool autoRelease = false) const;
//! bind buffer for specified target //! bind buffer for specified target
void bind(Target target) const; void bind(Target target) const;
...@@ -189,7 +189,7 @@ public: ...@@ -189,7 +189,7 @@ public:
void copyFrom(InputArray arr, bool autoRelease = false); void copyFrom(InputArray arr, bool autoRelease = false);
//! copy to host/device memory //! copy to host/device memory
void copyTo(OutputArray arr, int ddepth = CV_32F) const; void copyTo(OutputArray arr, int ddepth = CV_32F, bool autoRelease = false) const;
//! bind texture to current active texture unit for GL_TEXTURE_2D target //! bind texture to current active texture unit for GL_TEXTURE_2D target
void bind() const; void bind() const;
......
...@@ -672,11 +672,12 @@ void cv::GlBuffer::copyFrom(InputArray arr, Target target, bool autoRelease) ...@@ -672,11 +672,12 @@ void cv::GlBuffer::copyFrom(InputArray arr, Target target, bool autoRelease)
#endif #endif
} }
void cv::GlBuffer::copyTo(OutputArray arr, Target target) const void cv::GlBuffer::copyTo(OutputArray arr, Target target, bool autoRelease) const
{ {
#ifndef HAVE_OPENGL #ifndef HAVE_OPENGL
(void) arr; (void) arr;
(void) target; (void) target;
(void) autoRelease;
throw_nogl(); throw_nogl();
#else #else
const int kind = arr.kind(); const int kind = arr.kind();
...@@ -685,13 +686,13 @@ void cv::GlBuffer::copyTo(OutputArray arr, Target target) const ...@@ -685,13 +686,13 @@ void cv::GlBuffer::copyTo(OutputArray arr, Target target) const
{ {
case _InputArray::OPENGL_BUFFER: case _InputArray::OPENGL_BUFFER:
{ {
arr.getGlBufferRef().copyFrom(*this, target); arr.getGlBufferRef().copyFrom(*this, target, autoRelease);
break; break;
} }
case _InputArray::OPENGL_TEXTURE2D: case _InputArray::OPENGL_TEXTURE2D:
{ {
arr.getGlTexture2DRef().copyFrom(*this); arr.getGlTexture2DRef().copyFrom(*this, autoRelease);
break; break;
} }
...@@ -719,15 +720,16 @@ void cv::GlBuffer::copyTo(OutputArray arr, Target target) const ...@@ -719,15 +720,16 @@ void cv::GlBuffer::copyTo(OutputArray arr, Target target) const
#endif #endif
} }
GlBuffer cv::GlBuffer::clone(Target target) const GlBuffer cv::GlBuffer::clone(Target target, bool autoRelease) const
{ {
#ifndef HAVE_OPENGL #ifndef HAVE_OPENGL
(void) target; (void) target;
(void) autoRelease;
throw_nogl(); throw_nogl();
return GlBuffer(); return GlBuffer();
#else #else
GlBuffer buf; GlBuffer buf;
buf.copyFrom(*this, target); buf.copyFrom(*this, target, autoRelease);
return buf; return buf;
#endif #endif
} }
...@@ -1156,11 +1158,12 @@ void cv::GlTexture2D::copyFrom(InputArray arr, bool autoRelease) ...@@ -1156,11 +1158,12 @@ void cv::GlTexture2D::copyFrom(InputArray arr, bool autoRelease)
#endif #endif
} }
void cv::GlTexture2D::copyTo(OutputArray arr, int ddepth) const void cv::GlTexture2D::copyTo(OutputArray arr, int ddepth, bool autoRelease) const
{ {
#ifndef HAVE_OPENGL #ifndef HAVE_OPENGL
(void) arr; (void) arr;
(void) ddepth; (void) ddepth;
(void) autoRelease;
throw_nogl(); throw_nogl();
#else #else
const int kind = arr.kind(); const int kind = arr.kind();
...@@ -1173,7 +1176,7 @@ void cv::GlTexture2D::copyTo(OutputArray arr, int ddepth) const ...@@ -1173,7 +1176,7 @@ void cv::GlTexture2D::copyTo(OutputArray arr, int ddepth) const
case _InputArray::OPENGL_BUFFER: case _InputArray::OPENGL_BUFFER:
{ {
GlBuffer& buf = arr.getGlBufferRef(); GlBuffer& buf = arr.getGlBufferRef();
buf.create(rows_, cols_, CV_MAKE_TYPE(ddepth, cn), GlBuffer::PIXEL_PACK_BUFFER); buf.create(rows_, cols_, CV_MAKE_TYPE(ddepth, cn), GlBuffer::PIXEL_PACK_BUFFER, autoRelease);
buf.bind(GlBuffer::PIXEL_PACK_BUFFER); buf.bind(GlBuffer::PIXEL_PACK_BUFFER);
impl_->copyTo(dstFormat, gl_types[ddepth], 0); impl_->copyTo(dstFormat, gl_types[ddepth], 0);
GlBuffer::unbind(GlBuffer::PIXEL_PACK_BUFFER); GlBuffer::unbind(GlBuffer::PIXEL_PACK_BUFFER);
......
This diff is collapsed.
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