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/curverenderer01b-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/curverenderer01b-xxx.fp')
-rw-r--r-- | src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01b-xxx.fp | 53 |
1 files changed, 53 insertions, 0 deletions
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 new file mode 100644 index 000000000..59401289c --- /dev/null +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01b-xxx.fp @@ -0,0 +1,53 @@ +//Copyright 2010 JogAmp Community. All rights reserved. + +#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) +{ + vec2 rtex = vec2(abs(gcv_TexCoord.x),abs(gcv_TexCoord.y)); + vec3 c = gcu_ColorStatic.rgb; + + float alpha = 0.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; + + 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); +} |