summaryrefslogtreecommitdiffstats
path: root/src/opengl/gl2paintengineex/qglengineshadersource_p.h
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2009-04-17 12:00:08 +0200
committerTom Cooksey <thomas.cooksey@nokia.com>2009-04-17 12:00:08 +0200
commit4701bc6fa8fe47d5038ed0a86a4e6c0490c259fe (patch)
tree7cbfac5b452ff87a756f1578581f192e631b7dcd /src/opengl/gl2paintengineex/qglengineshadersource_p.h
parent534f2575a19422cff06e27b46f65c6630da6ee7f (diff)
Fix various issues with conical grad GLSL code
- atan2 is just called atan in GLSL (which supports overloads) - varyings can't be modified in fragment shaders - #defines need to be on their own line
Diffstat (limited to 'src/opengl/gl2paintengineex/qglengineshadersource_p.h')
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadersource_p.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h
index d605b011ed..7557431df3 100644
--- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h
@@ -183,15 +183,17 @@ static const char* const qglslPositionWithConicalGradientBrushVertexShader = "\
static const char* const qglslAffinePositionWithConicalGradientBrushVertexShader
= qglslPositionWithConicalGradientBrushVertexShader;
-static const char* const qglslConicalGradientBrushSrcFragmentShader = "\
+static const char* const qglslConicalGradientBrushSrcFragmentShader = "\n\
#define INVERSE_2PI 0.1591549430918953358 \n\
- uniform sampler2D brushTexture; \
+ uniform sampler2D brushTexture; \n\
uniform mediump float angle; \
varying highp vec2 A; \
lowp vec4 srcPixel() { \
+ highp float t; \
if (abs(A.y) == abs(A.x)) \
- A.y += 0.002; \
- highp float t = (atan2(-A.y, A.x) + angle) * INVERSE_2PI; \
+ t = (atan(-A.y + 0.002, A.x) + angle) * INVERSE_2PI; \
+ else \
+ t = (atan(-A.y, A.x) + angle) * INVERSE_2PI; \
return texture2D(brushTexture, vec2(t - floor(t), 0.5)); \
}";