diff options
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve/opengl')
-rw-r--r-- | src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl | 2 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/graph/curve/opengl/shader/consts.glsl | 2 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-es2.fp | 4 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-es2.vp | 3 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-sp-xxx.vp | 1 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01a-xxx.fp | 53 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01b-xxx.fp (renamed from src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-xxx.fp) | 52 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-es2.fp | 4 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/graph/curve/opengl/shader/precision.glsl | 10 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl | 4 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl | 4 |
11 files changed, 72 insertions, 67 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl index c8c076ba1..108247c9c 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl @@ -2,8 +2,6 @@ #ifndef attributes_glsl #define attributes_glsl -#include precision.glsl - // attribute vec3 gca_Vertices; attribute vec4 gca_Vertices; attribute vec2 gca_TexCoords; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/consts.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/consts.glsl index c399f0f57..58c4fe50c 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/consts.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/consts.glsl @@ -2,8 +2,6 @@ #ifndef consts_glsl #define consts_glsl -#include precision.glsl - const int MAX_TEXTURE_UNITS = 8; // <= gl_MaxTextureImageUnits // const int MAX_LIGHTS = 8; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-es2.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-es2.fp index 94e62c042..adf2c62bd 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-es2.fp +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-es2.fp @@ -6,5 +6,9 @@ // #extension OES_standard_derivatives : require #extension GL_OES_standard_derivatives : enable +precision mediump float; +precision mediump int; +precision mediump sampler2D; + #include curverenderer01-xxx.fp diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-es2.vp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-es2.vp index 8c0585b1d..15ce8cc2b 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-es2.vp +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-es2.vp @@ -2,5 +2,8 @@ #version 100 +precision mediump float; +precision mediump int; + #include curverenderer01-xxx.vp diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-sp-xxx.vp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-sp-xxx.vp index 8bf3beea1..530b24f64 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-sp-xxx.vp +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-sp-xxx.vp @@ -1,4 +1,5 @@ //Copyright 2010 JogAmp Community. All rights reserved. + #ifdef GL_ES precision lowp float; precision lowp int; 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 new file mode 100644 index 000000000..fba2edb64 --- /dev/null +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01a-xxx.fp @@ -0,0 +1,53 @@ +//Copyright 2010 JogAmp Community. All rights reserved. + +#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; + + 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) { + /** discard freezes NV tegra2 compiler (TODO: dbl check) + if(gcv_TexCoord.y < 0.0) { + discard; + } else { + rtex.y = 0.0; + }*/ + 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; + } else if (a <= 0.0) { + // discard; // freezes NV tegra2 compiler (TODO: dbl check) + alpha = 0.0; + } else { + alpha = gcu_Alpha * a; + // ?? mix(b_color,gcu_ColorStatic.rgb, a); + } + } + + gl_FragColor = vec4(c, alpha); +} diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-xxx.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01b-xxx.fp index af980da10..59401289c 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-xxx.fp +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01b-xxx.fp @@ -2,6 +2,7 @@ #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); @@ -10,22 +11,14 @@ 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)) { vec2 dfx = dFdx(gcv_TexCoord); vec2 dfy = dFdy(gcv_TexCoord); - vec2 size; - //#if __VERSION__ < 130 - 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,43 +42,12 @@ 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 (TODO: dbl check) 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)) { - vec2 dtx = dFdx(rtex); - vec2 dty = dFdy(rtex); - - rtex.y -= 0.1; - - if(rtex.y < 0.0) { - if(gcv_TexCoord.y < 0.0) { - discard; - } 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; - } else if (a <= 0.0) { - discard; - } else { - alpha = gcu_Alpha * a; - // ?? mix(b_color,gcu_ColorStatic.rgb, a); - } - } - - gl_FragColor = vec4(c, alpha); + 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/curverenderer02-es2.fp index 80702d721..9a2128765 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-es2.fp +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-es2.fp @@ -6,5 +6,9 @@ // #extension OES_standard_derivatives : require #extension GL_OES_standard_derivatives : enable +precision mediump float; +precision mediump int; +precision mediump sampler2D; + #include curverenderer02-xxx.fp diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/precision.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/precision.glsl deleted file mode 100644 index 9924bd790..000000000 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/precision.glsl +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef precision_glsl -#define precision_glsl - -#ifdef GL_ES - precision mediump float; - precision mediump int; - precision mediump sampler2D; -#endif - -#endif // precision_glsl 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 5d1177310..9d8ea75ea 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl @@ -2,10 +2,6 @@ #ifndef uniforms_glsl #define uniforms_glsl -#include precision.glsl - -// #include consts.glsl - uniform mat4 gcu_PMVMatrix[3]; // P, Mv, and Mvi uniform vec3 gcu_ColorStatic; uniform float gcu_Alpha; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl index adb40ad11..7a9bc5a07 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl @@ -2,10 +2,6 @@ #ifndef varyings_glsl #define varyings_glsl -#include precision.glsl - -#include consts.glsl - //varying vec4 gcv_FrontColor; varying vec2 gcv_TexCoord; |