diff --git a/effects/lookingglass/data/1.10/lookingglass.frag b/effects/lookingglass/data/1.10/lookingglass.frag
index 48edfb93db..992c9d42b8 100644
--- a/effects/lookingglass/data/1.10/lookingglass.frag
+++ b/effects/lookingglass/data/1.10/lookingglass.frag
@@ -4,15 +4,15 @@ uniform float u_zoom;
uniform float u_radius;
uniform vec2 u_textureSize;
-varying vec2 varyingTexCoords;
+varying vec2 texcoord0;
#define PI 3.14159
void main()
{
- vec2 d = u_cursor - varyingTexCoords;
+ vec2 d = u_cursor - texcoord0;
float dist = sqrt(d.x*d.x + d.y*d.y);
- vec2 texcoord = varyingTexCoords;
+ vec2 texcoord = texcoord0;
if (dist < u_radius) {
float disp = sin(dist / u_radius * PI) * (u_zoom - 1.0) * 20.0;
texcoord += d / dist * disp;
diff --git a/effects/lookingglass/data/1.40/lookingglass.frag b/effects/lookingglass/data/1.40/lookingglass.frag
index 239afc2699..56cf3cea8d 100644
--- a/effects/lookingglass/data/1.40/lookingglass.frag
+++ b/effects/lookingglass/data/1.40/lookingglass.frag
@@ -5,7 +5,7 @@ uniform float u_zoom;
uniform float u_radius;
uniform vec2 u_textureSize;
-in vec2 varyingTexCoords;
+in vec2 texcoord0;
out vec4 fragColor;
@@ -13,9 +13,9 @@ out vec4 fragColor;
void main()
{
- vec2 d = u_cursor - varyingTexCoords;
+ vec2 d = u_cursor - texcoord0;
float dist = sqrt(d.x*d.x + d.y*d.y);
- vec2 texcoord = varyingTexCoords;
+ vec2 texcoord = texcoord0;
if (dist < u_radius) {
float disp = sin(dist / u_radius * PI) * (u_zoom - 1.0) * 20.0;
texcoord += d / dist * disp;
diff --git a/effects/lookingglass/lookingglass.cpp b/effects/lookingglass/lookingglass.cpp
index 92865609af..4173e8eb8f 100644
--- a/effects/lookingglass/lookingglass.cpp
+++ b/effects/lookingglass/lookingglass.cpp
@@ -32,6 +32,7 @@ along with this program. If not, see .
#include
#include
#include
+#include
#include
@@ -116,7 +117,12 @@ bool LookingGlassEffect::loadData()
if (GLPlatform::instance()->glslVersion() >= coreVersionNumber)
shadersDir = QStringLiteral("kwin/shaders/1.40/");
const QString fragmentshader = QStandardPaths::locate(QStandardPaths::GenericDataLocation, shadersDir + QStringLiteral("lookingglass.frag"));
- m_shader = ShaderManager::instance()->loadFragmentShader(ShaderManager::SimpleShader, fragmentshader);
+ QFile ff(fragmentshader);
+ if (!ff.open(QIODevice::ReadOnly)) {
+ qCCritical(KWINEFFECTS) << "Failed to read shader!";
+ return false;
+ }
+ m_shader = ShaderManager::instance()->generateCustomShader(ShaderTrait::MapTexture, QByteArray(), ff.readAll());
if (m_shader->isValid()) {
ShaderBinder binder(m_shader);
m_shader->setUniform("u_textureSize", QVector2D(screenSize.width(), screenSize.height()));
@@ -228,10 +234,10 @@ void LookingGlassEffect::slotMouseChanged(const QPoint& pos, const QPoint& old,
}
}
-void LookingGlassEffect::postPaintScreen()
+void LookingGlassEffect::paintScreen(int mask, QRegion region, ScreenPaintData &data)
{
// Call the next effect.
- effects->postPaintScreen();
+ effects->paintScreen(mask, region, data);
if (m_valid && m_enabled) {
// Disable render texture
GLRenderTarget* target = GLRenderTarget::popRenderTarget();
@@ -245,6 +251,7 @@ void LookingGlassEffect::postPaintScreen()
m_shader->setUniform("u_zoom", (float)zoom);
m_shader->setUniform("u_radius", (float)radius);
m_shader->setUniform("u_cursor", QVector2D(cursorPos().x(), cursorPos().y()));
+ m_shader->setUniform(GLShader::ModelViewProjectionMatrix, data.projectionMatrix());
m_vbo->render(GL_TRIANGLES);
m_texture->unbind();
}
diff --git a/effects/lookingglass/lookingglass.h b/effects/lookingglass/lookingglass.h
index c4ab008faf..2252a70077 100644
--- a/effects/lookingglass/lookingglass.h
+++ b/effects/lookingglass/lookingglass.h
@@ -46,7 +46,7 @@ public:
virtual void reconfigure(ReconfigureFlags);
virtual void prePaintScreen(ScreenPrePaintData& data, int time);
- virtual void postPaintScreen();
+ void paintScreen(int mask, QRegion region, ScreenPaintData &data) override;
virtual bool isActive() const;
static bool supported();