From 4701bc6fa8fe47d5038ed0a86a4e6c0490c259fe Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Fri, 17 Apr 2009 12:00:08 +0200 Subject: 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 --- src/opengl/gl2paintengineex/qglengineshadersource_p.h | 10 ++++++---- 1 file 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)); \ }"; -- cgit v0.12