removed ogl::Texture2D support from InputArray

This commit is contained in:
Vladislav Vinogradov
2013-04-15 11:29:21 +04:00
parent 173442bb2e
commit 2fae1d9507
7 changed files with 61 additions and 172 deletions

View File

@@ -281,39 +281,64 @@ void cv::imshow( const String& winname, InputArray _img )
setOpenGlContext(winname);
if (_img.kind() == _InputArray::OPENGL_TEXTURE)
cv::ogl::Texture2D& tex = ownWndTexs[winname];
if (_img.kind() == _InputArray::GPU_MAT)
{
cv::ogl::Texture2D& tex = wndTexs[winname];
tex = _img.getOGlTexture2D();
cv::ogl::Buffer& buf = ownWndBufs[winname];
buf.copyFrom(_img);
buf.setAutoRelease(false);
tex.copyFrom(buf);
tex.setAutoRelease(false);
setOpenGlDrawCallback(winname, glDrawTextureCallback, &tex);
}
else
{
cv::ogl::Texture2D& tex = ownWndTexs[winname];
if (_img.kind() == _InputArray::GPU_MAT)
{
cv::ogl::Buffer& buf = ownWndBufs[winname];
buf.copyFrom(_img);
buf.setAutoRelease(false);
tex.copyFrom(buf);
tex.setAutoRelease(false);
}
else
{
tex.copyFrom(_img);
}
tex.setAutoRelease(false);
setOpenGlDrawCallback(winname, glDrawTextureCallback, &tex);
tex.copyFrom(_img);
}
tex.setAutoRelease(false);
setOpenGlDrawCallback(winname, glDrawTextureCallback, &tex);
updateWindow(winname);
}
#endif
}
void cv::imshow(const String& winname, const ogl::Texture2D& _tex)
{
#ifndef HAVE_OPENGL
(void) winname;
(void) _tex;
CV_Error(cv::Error::OpenGlNotSupported, "The library is compiled without OpenGL support");
#else
const double useGl = getWindowProperty(winname, WND_PROP_OPENGL);
if (useGl <= 0)
{
CV_Error(cv::Error::OpenGlNotSupported, "The window was created without OpenGL context");
}
else
{
const double autoSize = getWindowProperty(winname, WND_PROP_AUTOSIZE);
if (autoSize > 0)
{
Size size = _tex.size();
resizeWindow(winname, size.width, size.height);
}
setOpenGlContext(winname);
cv::ogl::Texture2D& tex = wndTexs[winname];
tex = _tex;
tex.setAutoRelease(false);
setOpenGlDrawCallback(winname, glDrawTextureCallback, &tex);
updateWindow(winname);
}
#endif