aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-06-11 01:29:30 +0200
committerSven Gothel <[email protected]>2014-06-11 01:29:30 +0200
commit3b6e6caeb24a112a2b1fbee5f54bbdc0bbf865c0 (patch)
treec3c2e36c4d208d3f78a07ab5afaadef330d959a5 /src/jogl
parentbc905a107d83d291f6ea34391768d16a9842bfc1 (diff)
Graph: Fix GLSL issue w/ ES3, add 'const float sample_count', since define SAMPLE_COUNT is of type 'int'
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java2
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allequal.glsl4
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad3.glsl6
3 files changed, 7 insertions, 5 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
index bb191e651..e8dc5f090 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
@@ -287,6 +287,7 @@ public class RegionRenderer {
private static String USE_COLOR_CHANNEL = "#define USE_COLOR_CHANNEL 1\n";
private static String USE_COLOR_TEXTURE = "#define USE_COLOR_TEXTURE 1\n";
private static String DEF_SAMPLE_COUNT = "#define SAMPLE_COUNT ";
+ private static String CONST_SAMPLE_COUNT = "const float sample_count = ";
private static String MAIN_BEGIN = "void main (void)\n{\n";
private static final String gcuTexture2D = "gcuTexture2D";
@@ -477,6 +478,7 @@ public class RegionRenderer {
}
if( !pass1 ) {
posFp = rsFp.insertShaderSource(0, posFp, DEF_SAMPLE_COUNT+sel1.sampleCount+"\n");
+ posFp = rsFp.insertShaderSource(0, posFp, CONST_SAMPLE_COUNT+sel1.sampleCount+".0;\n");
}
final String texLookupFuncName;
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allequal.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allequal.glsl
index da7feeaa7..0272c1f9f 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allequal.glsl
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allequal.glsl
@@ -1,11 +1,11 @@
// Pass-2: AA on Texture
// Note: gcv_FboTexCoord is in center of sample pixels.
- // float sampleCount = gcu_FboTexSize.z;
+ // float sample_count = gcu_FboTexSize.z;
vec2 psize = 1.0 / gcu_FboTexSize.xy; // pixel size
// Not only the poles (NW, SW, ..) but the whole edge!
- const float sample_weight = 1.0 / ( SAMPLE_COUNT * SAMPLE_COUNT );
+ const float sample_weight = 1.0 / ( sample_count * sample_count );
// const vec4 tex_weights = vec4(0.075, 0.06, 0.045, 0.025);
vec2 texCoord = gcv_FboTexCoord.st;
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad3.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad3.glsl
index 7a2cb0358..8cc108bd1 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad3.glsl
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad3.glsl
@@ -4,7 +4,7 @@
//
// Same as flipquad - but w/ rgss coordinates
- // float sampleCount = gcu_FboTexSize.z;
+ // float sample_count = gcu_FboTexSize.z;
vec2 psize = 1.0 / gcu_FboTexSize.xy; // pixel size
vec2 normFragCoord = gl_FragCoord.xy - vec2(0.5, 0.5); // normalize center 0.5/0.5 -> 0/0
@@ -24,7 +24,7 @@
// SampleCount 2 -> 2p
const float weight = 1.0 / 2.0;
- const float edge = ( SAMPLE_COUNT / 2.0 ) - 1.0;
+ const float edge = ( sample_count / 2.0 ) - 1.0;
t = GetSample(gcu_FboTexUnit, texCoord, psize, -edge, edge, -0.5, 0.5)*weight; // center
t += GetSample(gcu_FboTexUnit, texCoord, psize, edge, -edge, 0.5, -0.5)*weight; // center
@@ -33,7 +33,7 @@
// SampleCount 4 -> 4p
const float weight = 1.0 / 4.0;
- const float edgeS4_1Q = ( SAMPLE_COUNT / 2.0 ) - 1.0;
+ const float edgeS4_1Q = ( sample_count / 2.0 ) - 1.0;
if( 0.0 == orient ) {
// SWIPE LEFT -> RIGHT