aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph/curve/opengl/shader
diff options
context:
space:
mode:
authorRami Santina <[email protected]>2011-04-02 11:35:46 +0300
committerRami Santina <[email protected]>2011-04-02 11:35:46 +0300
commita53f4daf23e68f1f5819c9e911f8a520ce03926a (patch)
treef150af4e7c7ec56c197f88528bbe81395b733cb5 /src/jogl/classes/jogamp/graph/curve/opengl/shader
parentc139362afd97e92a6a20f77f60fe952f88b94ebb (diff)
Fragment Shader enhancement + clean-up;
in first pass the shader now discards pixels that are dropped by imlicit AA, and second pass (if executed) doesnt include them in AA clac.
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve/opengl/shader')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp38
1 files changed, 18 insertions, 20 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp
index 2b3a0ce1d..e07139a87 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp
@@ -1,3 +1,4 @@
+//Copyright 2010 JogAmp Community. All rights reserved.
//#version 100
uniform float p1y;
@@ -31,24 +32,24 @@ void main (void)
vec4 t = texture2D(texture, rtex)* 0.18;
t += texture2D(texture, rtex + size*(vec2(1, 0)))*weights.x;
- t += texture2D(texture, rtex - size*(vec2(1, 0)))*weights.x;
- t += texture2D(texture, rtex + size*(vec2(0, 1)))*weights.x;
- t += texture2D(texture, rtex - size*(vec2(0, 1)))*weights.x;
+ t += texture2D(texture, rtex - size*(vec2(1, 0)))*weights.x;
+ t += texture2D(texture, rtex + size*(vec2(0, 1)))*weights.x;
+ t += texture2D(texture, rtex - size*(vec2(0, 1)))*weights.x;
t += texture2D(texture, rtex + 2.0*size*(vec2(1, 0))) *weights.y;
- t += texture2D(texture, rtex - 2.0*size*(vec2(1, 0)))*weights.y;
- t += texture2D(texture, rtex + 2.0*size*(vec2(0, 1)))*weights.y;
- t += texture2D(texture, rtex - 2.0*size*(vec2(0, 1)))*weights.y;
+ t += texture2D(texture, rtex - 2.0*size*(vec2(1, 0)))*weights.y;
+ t += texture2D(texture, rtex + 2.0*size*(vec2(0, 1)))*weights.y;
+ t += texture2D(texture, rtex - 2.0*size*(vec2(0, 1)))*weights.y;
t += texture2D(texture, rtex + 3.0*size*(vec2(1, 0))) *weights.z;
- t += texture2D(texture, rtex - 3.0*size*(vec2(1, 0)))*weights.z;
- t += texture2D(texture, rtex + 3.0*size*(vec2(0, 1)))*weights.z;
- t += texture2D(texture, rtex - 3.0*size*(vec2(0, 1)))*weights.z;
+ t += texture2D(texture, rtex - 3.0*size*(vec2(1, 0)))*weights.z;
+ t += texture2D(texture, rtex + 3.0*size*(vec2(0, 1)))*weights.z;
+ t += texture2D(texture, rtex - 3.0*size*(vec2(0, 1)))*weights.z;
t += texture2D(texture, rtex + 4.0*size*(vec2(1, 0))) *weights.w;
- t += texture2D(texture, rtex - 4.0*size*(vec2(1, 0)))*weights.w;
- t += texture2D(texture, rtex + 4.0*size*(vec2(0, 1)))*weights.w;
- t += texture2D(texture, rtex - 4.0*size*(vec2(0, 1)))*weights.w;
+ t += texture2D(texture, rtex - 4.0*size*(vec2(1, 0)))*weights.w;
+ t += texture2D(texture, rtex + 4.0*size*(vec2(0, 1)))*weights.w;
+ t += texture2D(texture, rtex - 4.0*size*(vec2(0, 1)))*weights.w;
if(t.w == 0.0){
discard;
@@ -62,7 +63,8 @@ void main (void)
vec2 dtx = dFdx(rtex);
vec2 dty = dFdy(rtex);
- rtex.y -= 0.1;
+ rtex.y -= p1y - 0.1;
+
if(rtex.y < 0.0) {
if(v_texCoord.y < 0.0)
discard;
@@ -71,9 +73,9 @@ void main (void)
}
}
- vec2 f = vec2((dtx.y - 2.0*p1y*dtx.x + 4.0*p1y*rtex.x*dtx.x), (dty.y - 2.0*p1y*dty.x + 4.0*p1y*rtex.x*dty.x));
+ vec2 f = vec2((dtx.y - dtx.x + 2.0*rtex.x*dtx.x), (dty.y - dty.x + 2.0*rtex.x*dty.x));
- float position = rtex.y - ((2.0 * rtex.x * p1y) * (1.0 - rtex.x));
+ float position = rtex.y - (rtex.x * (1.0 - rtex.x));
float d = position/(length(f));
float a = (0.5 - d * sign(v_texCoord.y));
@@ -81,16 +83,12 @@ void main (void)
if (a >= 1.0) {
alpha = g_alpha;
- // c = vec3(1.0,1.0,1.0);
}
else if (a <= 0.0) {
- alpha = 0.0;//discard;
- // c = vec3(0.0,0.0,0.0);
-
+ discard;
}
else {
alpha = g_alpha*a;
- // c = vec3(a,a,a);
mix(b_color,g_color, a);
}
}