aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph/curve/opengl/shader
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-05-08 05:21:50 +0200
committerSven Gothel <[email protected]>2011-05-08 05:21:50 +0200
commite122b2f92b2302362569cdc9a67efd5750f46eb1 (patch)
tree8941dcce577ff5e1378a7322932c4bbfc586373c /src/jogl/classes/jogamp/graph/curve/opengl/shader
parentf88a51cb1c811bba5b5803aee03829b41da308c3 (diff)
Graph: GLSL fix, Adding renderModes bits instead of dedicated booleans, Region/GLRegion, ..
GLSL fix: - allowing #version tag - add uniform textureSize (ES2) - fix int/float conversion Region/GLRegion: - non OpenGL Region and GL related GLRegion split Region/Renderer renderModes bits (def. in Region) - user creates a Renderer* impl .. and derive Region*'s from outline, possibly from a different code path. - to avoid mode explosion, a bit field is being used for now - Renderer: remove flushCache(), since non caching impl. is intended, or caching by an external user transparent object.
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve/opengl/shader')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java1
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-es2.fp6
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-es2.vp6
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-gl2.fp6
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-gl2.vp6
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-xxx.fp (renamed from src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp)16
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-xxx.vp (renamed from src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.vp)9
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-es2.fp6
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-gl2.fp6
-rw-r--r--[-rwxr-xr-x]src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-xxx.fp (renamed from src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02.fp)16
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl4
11 files changed, 54 insertions, 28 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java b/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java
index bb6ff987d..ab6e0dc6e 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java
@@ -6,4 +6,5 @@ public class UniformNames {
public static final String gcu_Alpha = "gcu_Alpha";
public static final String gcu_Weight = "gcu_Weight";
public static final String gcu_TextureUnit = "gcu_TextureUnit";
+ public static final String gcu_TextureSize = "gcu_TextureSize";
}
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
new file mode 100644
index 000000000..0131f38b0
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-es2.fp
@@ -0,0 +1,6 @@
+//Copyright 2010 JogAmp Community. All rights reserved.
+
+#version 100
+
+#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
new file mode 100644
index 000000000..8c0585b1d
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-es2.vp
@@ -0,0 +1,6 @@
+//Copyright 2010 JogAmp Community. All rights reserved.
+
+#version 100
+
+#include curverenderer01-xxx.vp
+
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-gl2.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-gl2.fp
new file mode 100644
index 000000000..ba4c7daa0
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-gl2.fp
@@ -0,0 +1,6 @@
+//Copyright 2010 JogAmp Community. All rights reserved.
+
+#version 110
+
+#include curverenderer01-xxx.fp
+
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-gl2.vp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-gl2.vp
new file mode 100644
index 000000000..1ac33e8b3
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-gl2.vp
@@ -0,0 +1,6 @@
+//Copyright 2010 JogAmp Community. All rights reserved.
+
+#version 110
+
+#include curverenderer01-xxx.vp
+
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-xxx.fp
index b3693ec88..e50aea04d 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-xxx.fp
@@ -1,14 +1,5 @@
//Copyright 2010 JogAmp Community. All rights reserved.
-/**
- * AMD complains: #version must occur before any other statement in the program
-#ifdef GL_ES
- #version 100
-#else
- #version 110
-#endif
- */
-
#include uniforms.glsl
#include varyings.glsl
@@ -29,7 +20,12 @@ void main (void)
vec2 dfx = dFdx(gcv_TexCoord);
vec2 dfy = dFdy(gcv_TexCoord);
- vec2 size = 1.0/textureSize(gcu_TextureUnit,0); //version 130 - FIXME: replace with uniform value
+ vec2 size;
+ //#if __VERSION__ < 130
+ size = 1.0/gcu_TextureSize;
+ //#else
+ // size = 1.0/textureSize(gcu_TextureUnit,0);
+ //#endif
rtex -= 5.0;
vec4 t = texture2D(gcu_TextureUnit, rtex)* 0.18;
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.vp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-xxx.vp
index fe74caffb..64a6835ec 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.vp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-xxx.vp
@@ -1,14 +1,5 @@
//Copyright 2010 JogAmp Community. All rights reserved.
-/**
- * AMD complains: #version must occur before any other statement in the program
-#ifdef GL_ES
- #version 100
-#else
- #version 110
-#endif
- */
-
#include uniforms.glsl
#include attributes.glsl
#include varyings.glsl
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
new file mode 100644
index 000000000..358e68b81
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-es2.fp
@@ -0,0 +1,6 @@
+//Copyright 2010 JogAmp Community. All rights reserved.
+
+#version 100
+
+#include curverenderer02-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/curverenderer02-gl2.fp
new file mode 100644
index 000000000..d7fe31a08
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-gl2.fp
@@ -0,0 +1,6 @@
+//Copyright 2010 JogAmp Community. All rights reserved.
+
+#version 110
+
+#include curverenderer02-xxx.fp
+
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-xxx.fp
index e3d5bc074..c6a3c56c8 100755..100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02.fp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer02-xxx.fp
@@ -1,11 +1,4 @@
//Copyright 2010 JogAmp Community. All rights reserved.
-/**
-#ifdef GL_ES
- #version 100
-#else
- #version 110
-#endif
- */
#include uniforms.glsl
#include varyings.glsl
@@ -27,7 +20,12 @@ void main (void)
vec2 dfx = dFdx(gcv_TexCoord);
vec2 dfy = dFdy(gcv_TexCoord);
- vec2 size = 1.0/textureSize(gcu_TextureUnit,0); //version 130 - FIXME: replace with uniform value
+ // vec2 size;
+ //#if __VERSION__ < 130
+ vec2 size = 1.0/gcu_TextureSize;
+ //#else
+ // size = 1.0/textureSize(gcu_TextureUnit,0);
+ //#endif
rtex -= 5.0;
vec4 t = texture2D(gcu_TextureUnit, rtex)* 0.18;
@@ -79,7 +77,7 @@ void main (void)
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*rtex.x))/gd), (dty.y - (w*dty.x*(1.0 - 2*rtex.x))/gd));
+ 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));
float d = position/(length(f));
float a = (0.5 - d * sign(gcv_TexCoord.y));
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 332edd02b..6b3d846a3 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,10 @@ uniform HIGHP float gcu_Alpha;
uniform HIGHP float gcu_Weight;
uniform sampler2D gcu_TextureUnit;
+// #if __VERSION__ < 130
+ uniform HIGHP vec2 gcu_TextureSize;
+// #endif
+
// uniform HIGHP mat3 gcu_NormalMatrix; // transpose(inverse(ModelView)).3x3
// uniform LOWP int gcu_ColorEnabled;
// uniform LOWP int gcu_TexCoordEnabled[MAX_TEXTURE_UNITS];