From 5e06a8d665c65554904f9358e5dc0fb01c120639 Mon Sep 17 00:00:00 2001 From: Rami Santina Date: Sun, 2 Oct 2011 01:09:08 +0300 Subject: Added allin one shader stripped for graph. tegra2 hunting, single pass, no discard, lowp, and removed uneeded variables --- .../curve/opengl/shader/curverenderer01-sp-xxx.fp | 52 ++++++++++++++++++++++ .../curve/opengl/shader/curverenderer01-sp-xxx.vp | 18 ++++++++ 2 files changed, 70 insertions(+) create mode 100644 src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-sp-xxx.fp create mode 100644 src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-sp-xxx.vp (limited to 'src') diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-sp-xxx.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-sp-xxx.fp new file mode 100644 index 000000000..da32df51f --- /dev/null +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-sp-xxx.fp @@ -0,0 +1,52 @@ +//Copyright 2010 JogAmp Community. All rights reserved. + +#ifdef GL_ES + precision lowp float; + precision lowp int; +#endif + +uniform mat4 gcu_PMVMatrix[3]; // P, Mv, and Mvi +uniform vec3 gcu_ColorStatic; +uniform float gcu_Alpha; + +varying vec2 gcv_TexCoord; + +const vec3 b_color = vec3(1.0, 1.0, 1.0); + +void main (void) +{ + vec2 rtex = vec2(abs(gcv_TexCoord.x),abs(gcv_TexCoord.y)); + vec3 c = gcu_ColorStatic; + + 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) { + 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) { + alpha=0.0; + } else { + alpha = gcu_Alpha * a; + } + } + + gl_FragColor = vec4(c, alpha); +} 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 new file mode 100644 index 000000000..8bf3beea1 --- /dev/null +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-sp-xxx.vp @@ -0,0 +1,18 @@ +//Copyright 2010 JogAmp Community. All rights reserved. +#ifdef GL_ES + precision lowp float; + precision lowp int; +#endif + +uniform mat4 gcu_PMVMatrix[3]; // P, Mv, and Mvi +varying vec2 gcv_TexCoord; + +attribute vec4 gca_Vertices; +attribute vec2 gca_TexCoords; + + +void main(void) +{ + gl_Position = gcu_PMVMatrix[0] * gcu_PMVMatrix[1] * gca_Vertices; + gcv_TexCoord = gca_TexCoords; +} -- cgit v1.2.3