aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph/curve/opengl/shader
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-03-02 00:19:35 +0100
committerSven Gothel <[email protected]>2014-03-02 00:19:35 +0100
commit7b1a0c17fe5471557ab5e0db0334bed34edb553a (patch)
treec6242b548f4f9cbe2411c8cb4bc6dd6924437e8b /src/jogl/classes/jogamp/graph/curve/opengl/shader
parentc1218a7bcf42ae64b41e3d30bb1ee39c44b20a9f (diff)
Bug 801: Add MSAA_RENDERING_BIT ; VBAA: Uses GL_NEAREST (good result) ; Demos: Use local GLRegion for uncached text (perf.) ..
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve/opengl/shader')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm-weight.fp (renamed from src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass-weight.fp)0
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm.fp (renamed from src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass.fp)0
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa-weight.fp69
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa.fp62
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa-weight.fp (renamed from src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass-weight.fp)3
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa.fp (renamed from src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass.fp)4
6 files changed, 131 insertions, 7 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass-weight.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm-weight.fp
index 2248792cb..2248792cb 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass-weight.fp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm-weight.fp
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm.fp
index 94e551832..94e551832 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass.fp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm.fp
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa-weight.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa-weight.fp
new file mode 100644
index 000000000..a4c547939
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa-weight.fp
@@ -0,0 +1,69 @@
+//Copyright 2010 JogAmp Community. All rights reserved.
+
+//
+// 2-pass shader w/ weight
+//
+
+#if __VERSION__ >= 130
+ #define varying in
+ out vec4 mgl_FragColor;
+ #define texture2D texture
+#else
+ #define mgl_FragColor gl_FragColor
+#endif
+
+#include uniforms.glsl
+#include varyings.glsl
+
+void main (void)
+{
+ vec2 rtex = vec2(abs(gcv_TexCoord.x),abs(gcv_TexCoord.y));
+ vec3 c = gcu_ColorStatic.rgb;
+
+ float alpha = 0.0;
+
+ if((gcv_TexCoord.x == 0.0) && (gcv_TexCoord.y == 0.0)) {
+ alpha = gcu_Alpha;
+ }
+ else if((gcv_TexCoord.x >= 5.0)) {
+ rtex -= 5.0;
+ vec4 t = texture2D(gcu_TextureUnit, rtex);
+
+ #if 0
+ if(t.w == 0.0) {
+ discard; // discard freezes NV tegra2 compiler
+ }
+ #endif
+
+ c = t.xyz;
+ alpha = gcu_Alpha * t.w;
+ }
+ ///////////////////////////////////////////////////////////
+ else if ((gcv_TexCoord.x > 0.0) && (rtex.y > 0.0 || rtex.x == 1.0)) {
+ rtex.y -= 0.1;
+
+ if(rtex.y < 0.0 && gcv_TexCoord.y < 0.0) {
+ // discard; // freezes NV tegra2 compiler
+ alpha = 0.0;
+ } else {
+ rtex.y = max(rtex.y, 0.0);
+
+ vec2 dtx = dFdx(rtex);
+ vec2 dty = dFdy(rtex);
+
+ float w = gcu_Weight;
+ float pd = ((2.0 - (2.0*w))*rtex.x*rtex.x) + 2.0*(w-1.0)*rtex.x + 1.0;
+ float position = rtex.y - ((w*rtex.x*(1.0 - rtex.x))/pd);
+
+ float aph = 2.0 - 2.0*w;
+
+ float gd = (aph*rtex.x*rtex.x + 2.0*rtex.x + 1.0)*(aph*rtex.x*rtex.x + 2.0*rtex.x + 1.0);
+ vec2 f = vec2((dtx.y - (w*dtx.x*(1.0 - 2.0*rtex.x))/gd), (dty.y - (w*dty.x*(1.0 - 2.0*rtex.x))/gd));
+
+ float a = clamp(0.5 - ( position/length(f) ) * sign(gcv_TexCoord.y), 0.0, 1.0);
+ alpha = gcu_Alpha * a;
+ }
+ }
+
+ mgl_FragColor = vec4(c, alpha);
+}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa.fp
new file mode 100644
index 000000000..21cd9de71
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa.fp
@@ -0,0 +1,62 @@
+//Copyright 2010 JogAmp Community. All rights reserved.
+
+//
+// 2-pass shader w/o weight
+//
+
+#if __VERSION__ >= 130
+ #define varying in
+ out vec4 mgl_FragColor;
+ #define texture2D texture
+#else
+ #define mgl_FragColor gl_FragColor
+#endif
+
+#include uniforms.glsl
+#include varyings.glsl
+
+void main (void)
+{
+ vec2 rtex = vec2(abs(gcv_TexCoord.x),abs(gcv_TexCoord.y));
+ vec3 c = gcu_ColorStatic.rgb;
+
+ float alpha = 0.0;
+
+ if((gcv_TexCoord.x == 0.0) && (gcv_TexCoord.y == 0.0)) {
+ alpha = gcu_Alpha;
+ }
+ else if((gcv_TexCoord.x >= 5.0)) {
+ rtex -= 5.0;
+ vec4 t = texture2D(gcu_TextureUnit, rtex);
+
+ #if 0
+ if(t.w == 0.0) {
+ discard; // discard freezes NV tegra2 compiler
+ }
+ #endif
+
+ c = t.xyz;
+ alpha = gcu_Alpha * t.w;
+ }
+ else if ((gcv_TexCoord.x > 0.0) && (rtex.y > 0.0 || rtex.x == 1.0)) {
+ rtex.y -= 0.1;
+
+ if(rtex.y < 0.0 && gcv_TexCoord.y < 0.0) {
+ // discard; // freezes NV tegra2 compiler
+ alpha = 0.0;
+ } else {
+ rtex.y = max(rtex.y, 0.0);
+
+ vec2 dtx = dFdx(rtex);
+ vec2 dty = dFdy(rtex);
+
+ 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 - (rtex.x * (1.0 - rtex.x));
+
+ float a = clamp(0.5 - ( position/length(f) ) * sign(gcv_TexCoord.y), 0.0, 1.0);
+ alpha = gcu_Alpha * a;
+ }
+ }
+
+ mgl_FragColor = vec4(c, alpha);
+}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass-weight.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa-weight.fp
index e60556bc6..c048254df 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass-weight.fp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa-weight.fp
@@ -28,9 +28,6 @@ void main (void)
alpha = gcu_Alpha;
}
else if((gcv_TexCoord.x >= 5.0)) {
- vec2 dfx = dFdx(gcv_TexCoord);
- vec2 dfy = dFdy(gcv_TexCoord);
-
vec2 size = 1.0/gcu_TextureSize;
rtex -= 5.0;
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa.fp
index 0cf4cf88f..0e590a102 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass.fp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa.fp
@@ -23,15 +23,11 @@ void main (void)
vec3 c = gcu_ColorStatic.rgb;
float alpha = 0.0;
- float enable = 1.0;
if((gcv_TexCoord.x == 0.0) && (gcv_TexCoord.y == 0.0)) {
alpha = gcu_Alpha;
}
else if((gcv_TexCoord.x >= 5.0)) {
- vec2 dfx = dFdx(gcv_TexCoord);
- vec2 dfy = dFdy(gcv_TexCoord);
-
vec2 size = 1.0/gcu_TextureSize;
rtex -= 5.0;