diff --git a/effects/explosion/data/explosion.frag b/effects/explosion/data/explosion.frag
index 6cce152e8a..e0c8f8aa3d 100644
--- a/effects/explosion/data/explosion.frag
+++ b/effects/explosion/data/explosion.frag
@@ -3,8 +3,7 @@ uniform sampler2D startOffsetTexture;
uniform sampler2D endOffsetTexture;
uniform float factor;
uniform float scale;
-uniform float textureWidth;
-uniform float textureHeight;
+uniform vec2 windowSize;
const float regionTexSize = 512.0;
@@ -17,14 +16,14 @@ vec2 getOffset(sampler2D texture, vec2 pos)
vec2 pix2tex( vec2 pix )
{
- return vec2( pix.s / textureWidth, pix.t / textureHeight );
+ return pix/windowSize;
}
void main()
{
// Original (unscaled) position in pixels
// ### FIXME: Use a custom vertex shader that outputs the untransformed texcoords
- vec2 origpos = varyingTexCoords * vec2(textureWidth, textureHeight);
+ vec2 origpos = varyingTexCoords * windowSize;
// Position in pixels on the scaled window
vec2 pos = origpos * scale;
// Start/end position of current region
diff --git a/effects/explosion/explosion.cpp b/effects/explosion/explosion.cpp
index c148efaa74..75f56ac271 100644
--- a/effects/explosion/explosion.cpp
+++ b/effects/explosion/explosion.cpp
@@ -24,6 +24,7 @@ along with this program. If not, see .
#include
#include
+#include
#include
#include
@@ -152,6 +153,7 @@ void ExplosionEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Win
mShader->setUniform("screenTransformation", screenTransformation);
mShader->setUniform("factor", (float)mWindows[w]);
mShader->setUniform("scale", (float)scale);
+ mShader->setUniform("windowSize", QVector2D(w->width(), w->height()));
glActiveTexture(GL_TEXTURE4);
mStartOffsetTex->bind();
glActiveTexture(GL_TEXTURE5);