diff options
author | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-04-17 10:00:08 (GMT) |
---|---|---|
committer | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-04-17 10:00:08 (GMT) |
commit | 4701bc6fa8fe47d5038ed0a86a4e6c0490c259fe (patch) | |
tree | 7cbfac5b452ff87a756f1578581f192e631b7dcd /src/opengl | |
parent | 534f2575a19422cff06e27b46f65c6630da6ee7f (diff) | |
download | Qt-4701bc6fa8fe47d5038ed0a86a4e6c0490c259fe.zip Qt-4701bc6fa8fe47d5038ed0a86a4e6c0490c259fe.tar.gz Qt-4701bc6fa8fe47d5038ed0a86a4e6c0490c259fe.tar.bz2 |
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')
-rw-r--r-- | src/opengl/gl2paintengineex/qglengineshadersource_p.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h index d605b01..7557431 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)); \ }"; |