aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-10-04 02:48:22 +0200
committerSven Gothel <[email protected]>2011-10-04 02:48:22 +0200
commita095b7da968533120306ff9ef019685b6698272c (patch)
treef04c4043eafbfb7df255ea19aeeeeca69bd6e40c /src/jogl/classes/jogamp/graph
parentc76e858c7f4481cab2dae6e079e0db35e3b591e6 (diff)
Graph Shader Simplification, 'a'/'b' redefined; GraphUI 2-pass demo;
Graph Shader Simplification - remove enable factor and 2nd 'discard' branch - use build-in 'max'/'clamp' functions, supposed to be faster Graph Shader 'a'/'b' redefined - 'a' is 1-pass shader only - 'b' is 2-pass incl. (1st pass + 2nd pass) - Works well on ARM Mali-400 MP (Galaxy S2). - Doesn't work on NV tegra2 (P1202: Texture's gl states do not match with shader's), however 2-pass on mobile seems to be overkill for now. We may create a workaround (switch shader ..). GraphUI 2-pass demo; - Propagate renderModes and texSize to UIShape's render(..) - TODO: Remove GL dependency in UIShape, maybe use a callback or visitor model - Adding GarpUI 2-pass launcher (Android and Standalone)
Diffstat (limited to 'src/jogl/classes/jogamp/graph')
-rwxr-xr-xsrc/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java11
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/consts.glsl8
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01a-xxx.fp47
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01b-xxx.fp99
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02a-es2.fp (renamed from src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-es2.fp)2
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02a-gl2.fp (renamed from src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-gl2.fp)2
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02a-xxx.fp48
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02b-es2.fp14
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02b-gl2.fp6
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02b-xxx.fp (renamed from src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-xxx.fp)61
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl2
11 files changed, 185 insertions, 115 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
index 0218c729a..0217a6369 100755
--- a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
@@ -46,16 +46,11 @@ public class RegionRendererImpl01 extends RegionRenderer {
}
- /**
- * FIXME: 2nd pass shader !
- */
@Override
protected String getFragmentShaderName(GL2ES2 gl) {
- if(Region.isNonUniformWeight(renderModes)){
- // FIXME: split shader !
- return "curverenderer02" + getShaderGLVersionSuffix(gl);
- }
- return "curverenderer01a" + getShaderGLVersionSuffix(gl);
+ final String type = Region.isNonUniformWeight(renderModes) ? "02" : "01" ;
+ final String pass = Region.isVBAA(renderModes) ? "b" : "a" ;
+ return "curverenderer" + type + pass + getShaderGLVersionSuffix(gl);
}
protected boolean initShaderProgram(GL2ES2 gl) {
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/consts.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/consts.glsl
deleted file mode 100644
index 58c4fe50c..000000000
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/consts.glsl
+++ /dev/null
@@ -1,8 +0,0 @@
-
-#ifndef consts_glsl
-#define consts_glsl
-
-const int MAX_TEXTURE_UNITS = 8; // <= gl_MaxTextureImageUnits
-// const int MAX_LIGHTS = 8;
-
-#endif // consts_glsl
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01a-xxx.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01a-xxx.fp
index b51ec5808..f3a88adef 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01a-xxx.fp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01a-xxx.fp
@@ -1,51 +1,40 @@
//Copyright 2010 JogAmp Community. All rights reserved.
+//
+// 1-pass shader w/o weight
+//
+
#include uniforms.glsl
#include varyings.glsl
-const vec3 b_color = vec3(1.0, 1.0, 1.0);
-const vec4 tex_weights = vec4(0.075, 0.06, 0.045, 0.025);
-
void main (void)
{
vec2 rtex = vec2(abs(gcv_TexCoord.x),abs(gcv_TexCoord.y));
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 > 0.0) && (rtex.y > 0.0 || rtex.x == 1.0)) {
- vec2 dtx = dFdx(rtex);
- vec2 dty = dFdy(rtex);
-
rtex.y -= 0.1;
- if(rtex.y < 0.0) {
- if(gcv_TexCoord.y < 0.0) {
- // discard; // freezes NV tegra2 compiler (TODO: dbl check)
- enable = 0.0;
- } else {
- rtex.y = 0.0;
- }
- }
-
- 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 d = position/(length(f));
-
- float a = (0.5 - d * sign(gcv_TexCoord.y));
-
- if (a >= 1.0) {
- alpha = gcu_Alpha * enable;
- } else if (a <= 0.0) {
- // discard; // freezes NV tegra2 compiler (TODO: dbl check)
+ if(rtex.y < 0.0 && gcv_TexCoord.y < 0.0) {
+ // discard; // freezes NV tegra2 compiler
alpha = 0.0;
- } else {
- alpha = gcu_Alpha * a * enable;
- // ?? mix(b_color,gcu_ColorStatic.rgb, a);
+ } 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));
+
+ // FIXME: will we ever set gcu_Alpha != 1.0 ? If not, a==alpha!
+ float a = clamp(0.5 - ( position/length(f) ) * sign(gcv_TexCoord.y), 0.0, 1.0);
+ alpha = gcu_Alpha * a;
}
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01b-xxx.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01b-xxx.fp
index 4bef33dbe..879e41e4c 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01b-xxx.fp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01b-xxx.fp
@@ -1,10 +1,12 @@
//Copyright 2010 JogAmp Community. All rights reserved.
+//
+// 2-pass shader w/o weight
+//
+
#include uniforms.glsl
#include varyings.glsl
-#include consts.glsl
-const vec3 b_color = vec3(1.0, 1.0, 1.0);
const vec4 tex_weights = vec4(0.075, 0.06, 0.045, 0.025);
void main (void)
@@ -13,41 +15,68 @@ void main (void)
vec3 c = gcu_ColorStatic.rgb;
float alpha = 0.0;
+ float enable = 1.0;
- vec2 dfx = dFdx(gcv_TexCoord);
- vec2 dfy = dFdy(gcv_TexCoord);
-
- vec2 size = 1.0/gcu_TextureSize;
+ 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;
- vec4 t = texture2D(gcu_TextureUnit, rtex)* 0.18;
+ rtex -= 5.0;
+ vec4 t = texture2D(gcu_TextureUnit, rtex)* 0.18;
+
+ t += texture2D(gcu_TextureUnit, rtex + size*(vec2(1, 0)))*tex_weights.x;
+ t += texture2D(gcu_TextureUnit, rtex - size*(vec2(1, 0)))*tex_weights.x;
+ t += texture2D(gcu_TextureUnit, rtex + size*(vec2(0, 1)))*tex_weights.x;
+ t += texture2D(gcu_TextureUnit, rtex - size*(vec2(0, 1)))*tex_weights.x;
+
+ t += texture2D(gcu_TextureUnit, rtex + 2.0*size*(vec2(1, 0)))*tex_weights.y;
+ t += texture2D(gcu_TextureUnit, rtex - 2.0*size*(vec2(1, 0)))*tex_weights.y;
+ t += texture2D(gcu_TextureUnit, rtex + 2.0*size*(vec2(0, 1)))*tex_weights.y;
+ t += texture2D(gcu_TextureUnit, rtex - 2.0*size*(vec2(0, 1)))*tex_weights.y;
+
+ t += texture2D(gcu_TextureUnit, rtex + 3.0*size*(vec2(1, 0)))*tex_weights.z;
+ t += texture2D(gcu_TextureUnit, rtex - 3.0*size*(vec2(1, 0)))*tex_weights.z;
+ t += texture2D(gcu_TextureUnit, rtex + 3.0*size*(vec2(0, 1)))*tex_weights.z;
+ t += texture2D(gcu_TextureUnit, rtex - 3.0*size*(vec2(0, 1)))*tex_weights.z;
+
+ t += texture2D(gcu_TextureUnit, rtex + 4.0*size*(vec2(1, 0)))*tex_weights.w;
+ t += texture2D(gcu_TextureUnit, rtex - 4.0*size*(vec2(1, 0)))*tex_weights.w;
+ t += texture2D(gcu_TextureUnit, rtex + 4.0*size*(vec2(0, 1)))*tex_weights.w;
+ t += texture2D(gcu_TextureUnit, rtex - 4.0*size*(vec2(0, 1)))*tex_weights.w;
+
+ /** discard freezes NV tegra2 compiler
+ if(t.w == 0.0){
+ discard;
+ } */
+
+ 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));
+
+ // FIXME: will we ever set gcu_Alpha != 1.0 ? If not, a==alpha!
+ float a = clamp(0.5 - ( position/length(f) ) * sign(gcv_TexCoord.y), 0.0, 1.0);
+ alpha = gcu_Alpha * a;
+ }
+ }
- t += texture2D(gcu_TextureUnit, rtex + size*(vec2(1, 0)))*tex_weights.x;
- t += texture2D(gcu_TextureUnit, rtex - size*(vec2(1, 0)))*tex_weights.x;
- t += texture2D(gcu_TextureUnit, rtex + size*(vec2(0, 1)))*tex_weights.x;
- t += texture2D(gcu_TextureUnit, rtex - size*(vec2(0, 1)))*tex_weights.x;
-
- t += texture2D(gcu_TextureUnit, rtex + 2.0*size*(vec2(1, 0)))*tex_weights.y;
- t += texture2D(gcu_TextureUnit, rtex - 2.0*size*(vec2(1, 0)))*tex_weights.y;
- t += texture2D(gcu_TextureUnit, rtex + 2.0*size*(vec2(0, 1)))*tex_weights.y;
- t += texture2D(gcu_TextureUnit, rtex - 2.0*size*(vec2(0, 1)))*tex_weights.y;
-
- t += texture2D(gcu_TextureUnit, rtex + 3.0*size*(vec2(1, 0)))*tex_weights.z;
- t += texture2D(gcu_TextureUnit, rtex - 3.0*size*(vec2(1, 0)))*tex_weights.z;
- t += texture2D(gcu_TextureUnit, rtex + 3.0*size*(vec2(0, 1)))*tex_weights.z;
- t += texture2D(gcu_TextureUnit, rtex - 3.0*size*(vec2(0, 1)))*tex_weights.z;
-
- t += texture2D(gcu_TextureUnit, rtex + 4.0*size*(vec2(1, 0)))*tex_weights.w;
- t += texture2D(gcu_TextureUnit, rtex - 4.0*size*(vec2(1, 0)))*tex_weights.w;
- t += texture2D(gcu_TextureUnit, rtex + 4.0*size*(vec2(0, 1)))*tex_weights.w;
- t += texture2D(gcu_TextureUnit, rtex - 4.0*size*(vec2(0, 1)))*tex_weights.w;
-
- /** discard freezes NV tegra2 compiler (TODO: dbl check)
- if(t.w == 0.0){
- discard;
- } */
-
- c = t.xyz;
- alpha = gcu_Alpha * t.w;
gl_FragColor = vec4(c, alpha);
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-es2.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02a-es2.fp
index 9a2128765..b52420350 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-es2.fp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02a-es2.fp
@@ -10,5 +10,5 @@ precision mediump float;
precision mediump int;
precision mediump sampler2D;
-#include curverenderer02-xxx.fp
+#include curverenderer02a-xxx.fp
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-gl2.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02a-gl2.fp
index d7fe31a08..01715daa5 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-gl2.fp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02a-gl2.fp
@@ -2,5 +2,5 @@
#version 110
-#include curverenderer02-xxx.fp
+#include curverenderer02a-xxx.fp
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02a-xxx.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02a-xxx.fp
new file mode 100644
index 000000000..d31bafb5a
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02a-xxx.fp
@@ -0,0 +1,48 @@
+//Copyright 2010 JogAmp Community. All rights reserved.
+
+//
+// 1-pass shader w/ weight
+//
+
+#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 > 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));
+
+ // FIXME: will we ever set gcu_Alpha != 1.0 ? If not, a==alpha!
+ float a = clamp(0.5 - ( position/length(f) ) * sign(gcv_TexCoord.y), 0.0, 1.0);
+ alpha = gcu_Alpha * a;
+ }
+ }
+
+ gl_FragColor = vec4(c, alpha);
+}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02b-es2.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02b-es2.fp
new file mode 100644
index 000000000..e0486dd7b
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02b-es2.fp
@@ -0,0 +1,14 @@
+//Copyright 2010 JogAmp Community. All rights reserved.
+
+#version 100
+
+// we require dFdx/dFdy
+// #extension OES_standard_derivatives : require
+#extension GL_OES_standard_derivatives : enable
+
+precision mediump float;
+precision mediump int;
+precision mediump sampler2D;
+
+#include curverenderer02b-xxx.fp
+
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02b-gl2.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02b-gl2.fp
new file mode 100644
index 000000000..b1cc72188
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02b-gl2.fp
@@ -0,0 +1,6 @@
+//Copyright 2010 JogAmp Community. All rights reserved.
+
+#version 110
+
+#include curverenderer02b-xxx.fp
+
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-xxx.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02b-xxx.fp
index 4f66cb41e..be738498c 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-xxx.fp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02b-xxx.fp
@@ -1,9 +1,12 @@
//Copyright 2010 JogAmp Community. All rights reserved.
+//
+// 2-pass shader w/ weight
+//
+
#include uniforms.glsl
#include varyings.glsl
-const vec3 b_color = vec3(0.0, 0.0, 0.0);
const vec4 tex_weights = vec4(0.075, 0.06, 0.045, 0.025);
void main (void)
@@ -20,12 +23,8 @@ void main (void)
vec2 dfx = dFdx(gcv_TexCoord);
vec2 dfy = dFdy(gcv_TexCoord);
- // vec2 size;
- //#if __VERSION__ < 130
- vec2 size = 1.0/gcu_TextureSize;
- //#else
- // size = 1.0/textureSize(gcu_TextureUnit,0);
- //#endif
+ vec2 size = 1.0/gcu_TextureSize;
+
rtex -= 5.0;
vec4 t = texture2D(gcu_TextureUnit, rtex)* 0.18;
@@ -49,9 +48,10 @@ void main (void)
t += texture2D(gcu_TextureUnit, rtex + 4.0*size*(vec2(0, 1)))*tex_weights.w;
t += texture2D(gcu_TextureUnit, rtex - 4.0*size*(vec2(0, 1)))*tex_weights.w;
+ /** discard freezes NV tegra2 compiler
if(t.w == 0.0) {
discard;
- }
+ } */
c = t.xyz;
alpha = gcu_Alpha * t.w;
@@ -60,34 +60,29 @@ void main (void)
else if ((gcv_TexCoord.x > 0.0) && (rtex.y > 0.0 || rtex.x == 1.0)) {
rtex.y -= 0.1;
- if(rtex.y < 0.0) {
- if(gcv_TexCoord.y < 0.0) {
- discard;
- } else {
- 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);
+ 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);
- 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));
+ 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 d = position/(length(f));
- float a = (0.5 - d * sign(gcv_TexCoord.y));
- if (a >= 1.0) {
- alpha = gcu_Alpha;
- } else if (a <= 0.0) {
- discard;
- } else {
- alpha = gcu_Alpha*a;
+ 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));
+
+ // FIXME: will we ever set gcu_Alpha != 1.0 ? If not, a==alpha!
+ float a = clamp(0.5 - ( position/length(f) ) * sign(gcv_TexCoord.y), 0.0, 1.0);
+ alpha = gcu_Alpha * a;
}
}
+
gl_FragColor = vec4(c, alpha);
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl
index 9d8ea75ea..5bbd5de14 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl
@@ -12,6 +12,8 @@ uniform sampler2D gcu_TextureUnit;
uniform vec2 gcu_TextureSize;
// #endif
+// const int MAX_TEXTURE_UNITS = 8; // <= gl_MaxTextureImageUnits
+// const int MAX_LIGHTS = 8;
// uniform mat3 gcu_NormalMatrix; // transpose(inverse(ModelView)).3x3
// uniform int gcu_ColorEnabled;
// uniform int gcu_TexCoordEnabled[MAX_TEXTURE_UNITS];