summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp
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
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')
-rwxr-xr-xsrc/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java2
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java2
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp38
3 files changed, 20 insertions, 22 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
index c1f293fff..607a8d5df 100755
--- a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
@@ -47,7 +47,7 @@ public class RegionRendererImpl01 extends RegionRenderer {
* on the off-curve vertex. The high value of sharpness will
* result in high curvature.
*/
- private GLUniformData mgl_sharpness = new GLUniformData("p1y", 0.5f);
+ private GLUniformData mgl_sharpness = new GLUniformData("p1y", 0.0f);
GLUniformData mgl_alpha = new GLUniformData("g_alpha", 1.0f);
private GLUniformData mgl_color = new GLUniformData("g_color", 3, FloatBuffer.allocate(3));
private GLUniformData mgl_strength = new GLUniformData("a_strength", 3.0f);
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
index 0f0b91412..d7fbd8e33 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
@@ -47,7 +47,7 @@ public class TextRendererImpl01 extends TextRenderer {
* on the off-curve vertex. The high value of sharpness will
* result in high curvature.
*/
- private GLUniformData mgl_sharpness = new GLUniformData("p1y", 0.5f);
+ private GLUniformData mgl_sharpness = new GLUniformData("p1y", 0.0f);
GLUniformData mgl_alpha = new GLUniformData("g_alpha", 1.0f);
private GLUniformData mgl_color = new GLUniformData("g_color", 3, FloatBuffer.allocate(3));
private GLUniformData mgl_strength = new GLUniformData("a_strength", 1.8f);
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);
}
}