diff --git a/effects/coverswitch/CMakeLists.txt b/effects/coverswitch/CMakeLists.txt
index e4a0233779..15606d99db 100644
--- a/effects/coverswitch/CMakeLists.txt
+++ b/effects/coverswitch/CMakeLists.txt
@@ -14,8 +14,11 @@ install( FILES
DESTINATION ${SERVICES_INSTALL_DIR}/kwin )
install( FILES
- coverswitch/coverswitch-reflection.glsl
- DESTINATION ${DATA_INSTALL_DIR}/kwin )
+ coverswitch/shaders/1.10/coverswitch-reflection.glsl
+ DESTINATION ${DATA_INSTALL_DIR}/kwin/shaders/1.10 )
+install( FILES
+ coverswitch/shaders/1.40/coverswitch-reflection.glsl
+ DESTINATION ${DATA_INSTALL_DIR}/kwin/shaders/1.40 )
#######################################
diff --git a/effects/coverswitch/coverswitch.cpp b/effects/coverswitch/coverswitch.cpp
index dc44973216..dcc6c80597 100644
--- a/effects/coverswitch/coverswitch.cpp
+++ b/effects/coverswitch/coverswitch.cpp
@@ -33,6 +33,7 @@ along with this program. If not, see .
#include
#include
+#include
#include
@@ -66,7 +67,12 @@ CoverSwitchEffect::CoverSwitchEffect()
captionFont.setBold(true);
captionFont.setPointSize(captionFont.pointSize() * 2);
- const QString fragmentshader = KGlobal::dirs()->findResource("data", "kwin/coverswitch-reflection.glsl");
+ QString shadersDir = "kwin/shaders/1.10/";
+#ifndef KWIN_HAVE_OPENGLES
+ if (GLPlatform::instance()->glslVersion() >= kVersionNumber(1, 40))
+ shadersDir = "kwin/shaders/1.40/";
+#endif
+ const QString fragmentshader = KGlobal::dirs()->findResource("data", shadersDir + "coverswitch-reflection.glsl");
m_reflectionShader = ShaderManager::instance()->loadFragmentShader(ShaderManager::GenericShader, fragmentshader);
connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*)));
connect(effects, SIGNAL(tabBoxAdded(int)), this, SLOT(slotTabBoxAdded(int)));
@@ -264,9 +270,6 @@ void CoverSwitchEffect::paintScreen(int mask, QRegion region, ScreenPaintData& d
paintScene(frontWindow, leftWindows, rightWindows, true);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-#ifndef KWIN_HAVE_OPENGLES
- glPolygonMode(GL_FRONT, GL_FILL);
-#endif
// we can use a huge scale factor (needed to calculate the rearground vertices)
// as we restrict with a PaintClipper painting on the current screen
float reflectionScaleFactor = 100000 * tan(60.0 * M_PI / 360.0f) / area.width();
diff --git a/effects/coverswitch/coverswitch-reflection.glsl b/effects/coverswitch/shaders/1.10/coverswitch-reflection.glsl
similarity index 100%
rename from effects/coverswitch/coverswitch-reflection.glsl
rename to effects/coverswitch/shaders/1.10/coverswitch-reflection.glsl
diff --git a/effects/coverswitch/shaders/1.40/coverswitch-reflection.glsl b/effects/coverswitch/shaders/1.40/coverswitch-reflection.glsl
new file mode 100644
index 0000000000..7b45a4fac8
--- /dev/null
+++ b/effects/coverswitch/shaders/1.40/coverswitch-reflection.glsl
@@ -0,0 +1,12 @@
+#version 140
+uniform vec4 u_frontColor;
+uniform vec4 u_backColor;
+
+in vec2 varyingTexCoords;
+
+out vec4 fragColor;
+
+void main()
+{
+ fragColor = u_frontColor*(1.0-varyingTexCoords.s) + u_backColor*varyingTexCoords.s;
+}