diff --git a/effects/backgroundcontrast/contrastshader.cpp b/effects/backgroundcontrast/contrastshader.cpp
index 96c6f3ad1f..12ce0f1e02 100644
--- a/effects/backgroundcontrast/contrastshader.cpp
+++ b/effects/backgroundcontrast/contrastshader.cpp
@@ -113,12 +113,7 @@ void ContrastShader::init()
{
reset();
-
-#ifdef KWIN_HAVE_OPENGLES
- const bool glsl_140 = false;
-#else
- const bool glsl_140 = GLPlatform::instance()->glslVersion() >= kVersionNumber(1, 40);
-#endif
+ const bool glsl_140 = !GLPlatform::instance()->isGLES() && GLPlatform::instance()->glslVersion() >= kVersionNumber(1, 40);
QByteArray vertexSource;
QByteArray fragmentSource;
diff --git a/effects/blur/blurshader.cpp b/effects/blur/blurshader.cpp
index a7da1a7d2a..4faf70ede7 100644
--- a/effects/blur/blurshader.cpp
+++ b/effects/blur/blurshader.cpp
@@ -173,18 +173,18 @@ void GLSLBlurShader::unbind()
int GLSLBlurShader::maxKernelSize() const
{
-#ifdef KWIN_HAVE_OPENGLES
- // GL_MAX_VARYING_FLOATS not available in GLES
- // querying for GL_MAX_VARYING_VECTORS crashes on nouveau
- // using the minimum value of 8
- return 8 * 2;
-#else
- int value;
- glGetIntegerv(GL_MAX_VARYING_FLOATS, &value);
- // Maximum number of vec4 varyings * 2
- // The code generator will pack two vec2's into each vec4.
- return value / 2;
-#endif
+ if (GLPlatform::instance()->isGLES()) {
+ // GL_MAX_VARYING_FLOATS not available in GLES
+ // querying for GL_MAX_VARYING_VECTORS crashes on nouveau
+ // using the minimum value of 8
+ return 8 * 2;
+ } else {
+ int value;
+ glGetIntegerv(GL_MAX_VARYING_FLOATS, &value);
+ // Maximum number of vec4 varyings * 2
+ // The code generator will pack two vec2's into each vec4.
+ return value / 2;
+ }
}
void GLSLBlurShader::init()
@@ -208,11 +208,7 @@ void GLSLBlurShader::init()
offsets << vec4;
}
-#ifdef KWIN_HAVE_OPENGLES
- const bool glsl_140 = false;
-#else
- const bool glsl_140 = GLPlatform::instance()->glslVersion() >= kVersionNumber(1, 40);
-#endif
+ const bool glsl_140 = !GLPlatform::instance()->isGLES() && GLPlatform::instance()->glslVersion() >= kVersionNumber(1, 40);
QByteArray vertexSource;
QByteArray fragmentSource;
diff --git a/effects/coverswitch/coverswitch.cpp b/effects/coverswitch/coverswitch.cpp
index 92772d4b2f..a5ffea6f35 100644
--- a/effects/coverswitch/coverswitch.cpp
+++ b/effects/coverswitch/coverswitch.cpp
@@ -61,11 +61,7 @@ CoverSwitchEffect::CoverSwitchEffect()
if (effects->compositingType() == OpenGL2Compositing) {
QString shadersDir = QStringLiteral("kwin/shaders/1.10/");
-#ifdef KWIN_HAVE_OPENGLES
- const qint64 coreVersionNumber = kVersionNumber(3, 0);
-#else
- const qint64 coreVersionNumber = kVersionNumber(1, 40);
-#endif
+ const qint64 coreVersionNumber = GLPlatform::instance()->isGLES() ? kVersionNumber(3, 0) : kVersionNumber(1, 40);
if (GLPlatform::instance()->glslVersion() >= coreVersionNumber)
shadersDir = QStringLiteral("kwin/shaders/1.40/");
const QString fragmentshader = QStandardPaths::locate(QStandardPaths::GenericDataLocation, shadersDir + QStringLiteral("coverswitch-reflection.glsl"));
diff --git a/effects/cube/cube.cpp b/effects/cube/cube.cpp
index 1a414cd377..516275d5c5 100644
--- a/effects/cube/cube.cpp
+++ b/effects/cube/cube.cpp
@@ -96,11 +96,7 @@ CubeEffect::CubeEffect()
desktopNameFont.setBold(true);
desktopNameFont.setPointSize(14);
-#ifdef KWIN_HAVE_OPENGLES
- const qint64 coreVersionNumber = kVersionNumber(3, 0);
-#else
- const qint64 coreVersionNumber = kVersionNumber(1, 40);
-#endif
+ const qint64 coreVersionNumber = GLPlatform::instance()->isGLES() ? kVersionNumber(3, 0) : kVersionNumber(1, 40);
if (GLPlatform::instance()->glslVersion() >= coreVersionNumber)
m_shadersDir = QStringLiteral("kwin/shaders/1.40/");
@@ -262,9 +258,9 @@ void CubeEffect::slotCubeCapLoaded()
effects->makeOpenGLContextCurrent();
capTexture = new GLTexture(img);
capTexture->setFilter(GL_LINEAR);
-#ifndef KWIN_HAVE_OPENGLES
- capTexture->setWrapMode(GL_CLAMP_TO_BORDER);
-#endif
+ if (!GLPlatform::instance()->isGLES()) {
+ capTexture->setWrapMode(GL_CLAMP_TO_BORDER);
+ }
// need to recreate the VBO for the cube cap
delete m_cubeCapBuffer;
m_cubeCapBuffer = NULL;
@@ -445,10 +441,10 @@ void CubeEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
m_reflectionMatrix.translate(0.0, sin(fabs(manualAngle) * M_PI / 360.0f * float(effects->numberOfDesktops())) * addedHeight2 + addedHeight1 - float(rect.height()), 0.0);
}
-#ifndef KWIN_HAVE_OPENGLES
// TODO: find a solution for GLES
- glEnable(GL_CLIP_PLANE0);
-#endif
+ if (!GLPlatform::instance()->isGLES()) {
+ glEnable(GL_CLIP_PLANE0);
+ }
reflectionPainting = true;
glEnable(GL_CULL_FACE);
paintCap(true, -point - zTranslate);
@@ -463,10 +459,10 @@ void CubeEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
paintCap(false, -point - zTranslate);
glDisable(GL_CULL_FACE);
reflectionPainting = false;
-#ifndef KWIN_HAVE_OPENGLES
// TODO: find a solution for GLES
- glDisable(GL_CLIP_PLANE0);
-#endif
+ if (!GLPlatform::instance()->isGLES()) {
+ glDisable(GL_CLIP_PLANE0);
+ }
const float width = rect.width();
const float height = rect.height();
@@ -1784,14 +1780,14 @@ void CubeEffect::setActive(bool active)
desktopChangedWhileRotating = false;
if (reflection) {
QRect rect = effects->clientArea(FullArea, activeScreen, effects->currentDesktop());
-#ifndef KWIN_HAVE_OPENGLES
// clip parts above the reflection area
- double eqn[4] = {0.0, 1.0, 0.0, 0.0};
- glPushMatrix();
- glTranslatef(0.0, rect.height(), 0.0);
- glClipPlane(GL_CLIP_PLANE0, eqn);
- glPopMatrix();
-#endif
+ if (!GLPlatform::instance()->isGLES()) {
+ double eqn[4] = {0.0, 1.0, 0.0, 0.0};
+ glPushMatrix();
+ glTranslatef(0.0, rect.height(), 0.0);
+ glClipPlane(GL_CLIP_PLANE0, eqn);
+ glPopMatrix();
+ }
float temporaryCoeff = float(rect.width()) / tan(M_PI / float(effects->numberOfDesktops()));
mAddedHeightCoeff1 = sqrt(float(rect.height()) * float(rect.height()) + temporaryCoeff * temporaryCoeff);
mAddedHeightCoeff2 = sqrt(float(rect.height()) * float(rect.height()) + float(rect.width()) * float(rect.width()) + temporaryCoeff * temporaryCoeff);
diff --git a/effects/invert/invert.cpp b/effects/invert/invert.cpp
index 67a9f89e72..2ecad094ca 100644
--- a/effects/invert/invert.cpp
+++ b/effects/invert/invert.cpp
@@ -74,11 +74,7 @@ bool InvertEffect::loadData()
m_inited = true;
QString shadersDir = QStringLiteral("kwin/shaders/1.10/");
-#ifdef KWIN_HAVE_OPENGLES
- const qint64 coreVersionNumber = kVersionNumber(3, 0);
-#else
- const qint64 coreVersionNumber = kVersionNumber(1, 40);
-#endif
+ const qint64 coreVersionNumber = GLPlatform::instance()->isGLES() ? kVersionNumber(3, 0) : kVersionNumber(1, 40);
if (GLPlatform::instance()->glslVersion() >= coreVersionNumber)
shadersDir = QStringLiteral("kwin/shaders/1.40/");
const QString fragmentshader = QStandardPaths::locate(QStandardPaths::GenericDataLocation, shadersDir + QStringLiteral("invert.frag"));
diff --git a/effects/logout/logout.cpp b/effects/logout/logout.cpp
index f13e50a7d6..20d793733d 100644
--- a/effects/logout/logout.cpp
+++ b/effects/logout/logout.cpp
@@ -62,11 +62,7 @@ LogoutEffect::LogoutEffect()
connect(effects, SIGNAL(propertyNotify(KWin::EffectWindow*,long)), this, SLOT(slotPropertyNotify(KWin::EffectWindow*,long)));
if (effects->isOpenGLCompositing()) {
-#ifdef KWIN_HAVE_OPENGLES
- const qint64 coreVersionNumber = kVersionNumber(3, 0);
-#else
- const qint64 coreVersionNumber = kVersionNumber(1, 40);
-#endif
+ const qint64 coreVersionNumber = GLPlatform::instance()->isGLES() ? kVersionNumber(3, 0) : kVersionNumber(1, 40);
if (GLPlatform::instance()->glslVersion() >= coreVersionNumber)
m_shadersDir = QStringLiteral("kwin/shaders/1.40/");
}
diff --git a/effects/lookingglass/lookingglass.cpp b/effects/lookingglass/lookingglass.cpp
index a3b38f3c2c..92865609af 100644
--- a/effects/lookingglass/lookingglass.cpp
+++ b/effects/lookingglass/lookingglass.cpp
@@ -112,11 +112,7 @@ bool LookingGlassEffect::loadData()
}
QString shadersDir = QStringLiteral("kwin/shaders/1.10/");
-#ifdef KWIN_HAVE_OPENGLES
- const qint64 coreVersionNumber = kVersionNumber(3, 0);
-#else
- const qint64 coreVersionNumber = kVersionNumber(1, 40);
-#endif
+ const qint64 coreVersionNumber = GLPlatform::instance()->isGLES() ? kVersionNumber(3, 0) : kVersionNumber(1, 40);
if (GLPlatform::instance()->glslVersion() >= coreVersionNumber)
shadersDir = QStringLiteral("kwin/shaders/1.40/");
const QString fragmentshader = QStandardPaths::locate(QStandardPaths::GenericDataLocation, shadersDir + QStringLiteral("lookingglass.frag"));
diff --git a/effects/mousemark/mousemark.cpp b/effects/mousemark/mousemark.cpp
index 443d4bfd2b..95fade8c70 100644
--- a/effects/mousemark/mousemark.cpp
+++ b/effects/mousemark/mousemark.cpp
@@ -26,6 +26,7 @@ along with this program. If not, see .
#include
#include
+#include
#include
#include
#include
@@ -116,9 +117,9 @@ void MouseMarkEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat
if (marks.isEmpty() && drawing.isEmpty())
return;
if ( effects->isOpenGLCompositing()) {
-#ifndef KWIN_HAVE_OPENGLES
- glEnable(GL_LINE_SMOOTH);
-#endif
+ if (!GLPlatform::instance()->isGLES()) {
+ glEnable(GL_LINE_SMOOTH);
+ }
glLineWidth(width);
GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer();
vbo->reset();
@@ -145,9 +146,9 @@ void MouseMarkEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat
vbo->render(GL_LINE_STRIP);
}
glLineWidth(1.0);
- #ifndef KWIN_HAVE_OPENGLES
- glDisable(GL_LINE_SMOOTH);
- #endif
+ if (!GLPlatform::instance()->isGLES()) {
+ glDisable(GL_LINE_SMOOTH);
+ }
}
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
if ( effects->compositingType() == XRenderCompositing) {
diff --git a/effects/screenshot/screenshot.cpp b/effects/screenshot/screenshot.cpp
index 55db6e8744..5a0c52eec3 100644
--- a/effects/screenshot/screenshot.cpp
+++ b/effects/screenshot/screenshot.cpp
@@ -19,6 +19,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*********************************************************************/
#include "screenshot.h"
+#include
#include
#include
#include
@@ -237,11 +238,11 @@ QString ScreenShotEffect::blitScreenshot(const QRect &geometry)
// copy content from framebuffer into image
tex.bind();
img = QImage(geometry.size(), QImage::Format_ARGB32);
-#ifdef KWIN_HAVE_OPENGLES
- glReadPixels(0, 0, img.width(), img.height(), GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)img.bits());
-#else
- glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)img.bits());
-#endif
+ if (GLPlatform::instance()->isGLES()) {
+ glReadPixels(0, 0, img.width(), img.height(), GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)img.bits());
+ } else {
+ glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)img.bits());
+ }
tex.unbind();
ScreenShotEffect::convertFromGLImage(img, geometry.width(), geometry.height());
}