diff --git a/plugins/scenes/opengl/scene_opengl.h b/plugins/scenes/opengl/scene_opengl.h --- a/plugins/scenes/opengl/scene_opengl.h +++ b/plugins/scenes/opengl/scene_opengl.h @@ -173,6 +173,8 @@ bool m_hardwareClipping; }; +class OpenGLWindowPixmap; + class SceneOpenGL2Window : public SceneOpenGL::Window { public: @@ -209,6 +211,7 @@ virtual void performPaint(int mask, QRegion region, WindowPaintData data); private: + void renderSubSurface(GLShader *shader, const QMatrix4x4 &mvp, const QMatrix4x4 &windowMatrix, OpenGLWindowPixmap *pixmap, const QRegion ®ion, bool hardwareClipping); /** * Whether prepareStates enabled blending and restore states should disable again. **/ diff --git a/plugins/scenes/opengl/scene_opengl.cpp b/plugins/scenes/opengl/scene_opengl.cpp --- a/plugins/scenes/opengl/scene_opengl.cpp +++ b/plugins/scenes/opengl/scene_opengl.cpp @@ -47,6 +47,7 @@ #include "decorations/decoratedclient.h" #include +#include #include #include @@ -1358,7 +1359,7 @@ return scene->projectionMatrix() * mvMatrix; } -static void renderSubSurface(GLShader *shader, const QMatrix4x4 &mvp, const QMatrix4x4 &windowMatrix, OpenGLWindowPixmap *pixmap, const QRegion ®ion, bool hardwareClipping) +void SceneOpenGL2Window::renderSubSurface(GLShader *shader, const QMatrix4x4 &mvp, const QMatrix4x4 &windowMatrix, OpenGLWindowPixmap *pixmap, const QRegion ®ion, bool hardwareClipping) { QMatrix4x4 newWindowMatrix = windowMatrix; newWindowMatrix.translate(pixmap->subSurface()->position().x(), pixmap->subSurface()->position().y()); @@ -1369,6 +1370,7 @@ } if (!pixmap->texture()->isNull()) { + setBlendEnabled(pixmap->buffer() && pixmap->buffer()->hasAlphaChannel()); // render this texture shader->setUniform(GLShader::ModelViewProjectionMatrix, mvp * newWindowMatrix); auto texture = pixmap->texture(); @@ -1515,8 +1517,6 @@ vbo->unbindArrays(); - setBlendEnabled(false); - // render sub-surfaces auto wp = windowPixmap(); const auto &children = wp ? wp->children() : QVector(); @@ -1528,6 +1528,8 @@ renderSubSurface(shader, modelViewProjection, windowMatrix, static_cast(pixmap), region, m_hardwareClipping); } + setBlendEnabled(false); + if (!data.shader) ShaderManager::instance()->popShader();