From ab860d8b7f58bb68f102dfb3b3ee0b6488c811a1 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Mon, 11 May 2015 18:33:05 +0200 Subject: Fix texture unit bug in the YUV video node. fe13f5bb introduced a bug which could leave the active texture unit set to GL_TEXTURE1 or GL_TEXTURE2. When the material is done updating its state, it needs to make sure the active texture unit is reset to 0 since other materials might assume that's the current value. Change-Id: I64a6a0cd9fcecdf0fa483909193f70045ff0e9fe Reviewed-by: Laszlo Agocs --- src/qtmultimediaquicktools/qsgvideonode_yuv.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/qtmultimediaquicktools') diff --git a/src/qtmultimediaquicktools/qsgvideonode_yuv.cpp b/src/qtmultimediaquicktools/qsgvideonode_yuv.cpp index 9da1023bb..c920ba3b9 100644 --- a/src/qtmultimediaquicktools/qsgvideonode_yuv.cpp +++ b/src/qtmultimediaquicktools/qsgvideonode_yuv.cpp @@ -318,7 +318,8 @@ void QSGVideoMaterial_YUV::bind() m_frame = QVideoFrame(); } else { - for (int i = 0; i < m_planeCount; ++i) { + // Go backwards to finish with GL_TEXTURE0 + for (int i = m_planeCount - 1; i >= 0; --i) { functions->glActiveTexture(GL_TEXTURE0 + i); functions->glBindTexture(GL_TEXTURE_2D, m_textureIds[i]); } -- cgit v1.2.3