diff options
author | Rami Santina <[email protected]> | 2011-10-02 02:35:46 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-10-02 02:35:46 +0200 |
commit | 2689d5d6c892d197ba10240ee4c2e281032e6ade (patch) | |
tree | 5aff4821a62a7535360907958e10301b825f7494 /src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01a-xxx.fp | |
parent | 5e06a8d665c65554904f9358e5dc0fb01c120639 (diff) |
tegra2: split fragment shaders into two (a - 1st pass, b - 2nd pass) ; disabled discard
- 1st pass (a) and 2nd pass (b), split at branch.
- all include are on one level.
- disabled discard, as it seems to be problematic
Todo:
- verify discard / pass-split on tegra2
- refect second pass usage (b) in implementation
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01a-xxx.fp')
-rw-r--r-- | src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01a-xxx.fp | 53 |
1 files changed, 53 insertions, 0 deletions
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); +} |