Make sure QVideoSurfaceGLPainter always uses a valid texture.
authorYoann Lopes <yoann.lopes@digia.com>
Wed, 16 Jan 2013 12:06:51 +0000 (13:06 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 16 Jan 2013 17:02:27 +0000 (18:02 +0100)
QVideoSurfaceGLPainter should not assume that the GL texture provided
by the QVideoFrame is fully initialized for drawing.

Change-Id: I752ecf69a3cf1faf0a7cf8f84b372c3b347824be
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
src/multimediawidgets/qpaintervideosurface.cpp

index c678c23..e925f57 100644 (file)
@@ -357,6 +357,11 @@ QAbstractVideoSurface::Error QVideoSurfaceGLPainter::setCurrentFrame(const QVide
 
     if (m_handleType == QAbstractVideoBuffer::GLTextureHandle) {
         m_textureIds[0] = frame.handle().toInt();
+        glBindTexture(GL_TEXTURE_2D, m_textureIds[0]);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
     } else if (m_frame.map(QAbstractVideoBuffer::ReadOnly)) {
         m_context->makeCurrent();