summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-07-09 21:32:13 +0200
committerSven Gothel <[email protected]>2014-07-09 21:32:13 +0200
commitefa5f1110725d41b7ea58010fe34b2a8aacd185b (patch)
tree61e5817a13717579f0b8853c8dc3498bc182a7bd /src
parent4fd8983ecce4c95ff502604fbeb4ecabcf1f5c26 (diff)
Bug 801: Add Graph pass-2 shader for VBAA 'odd' sample count
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java43
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java4
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_bforce_even.glsl (renamed from src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allequal.glsl)128
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_bforce_odd.glsl87
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java10
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/ui/SceneUIController.java6
6 files changed, 188 insertions, 90 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 289730ca0..23b82639f 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
@@ -323,14 +323,23 @@ public class RegionRenderer {
PASS2_VBAA_QUAL0_SAMPLES4("vbaa", "_flipquad3", 4),
/** Pass-2: VBAA Flipquad3, 8 samples */
PASS2_VBAA_QUAL0_SAMPLES8("vbaa", "_flipquad3", 8),
- /** Pass-2: VBAA All-Equal, 2 samples */
- PASS2_VBAA_QUAL1_SAMPLES2("vbaa", "_allequal", 2),
- /** Pass-2: VBAA All-Equal, 4 samples */
- PASS2_VBAA_QUAL1_SAMPLES4("vbaa", "_allequal", 4),
- /** Pass-2: VBAA All-Equal, 6 samples */
- PASS2_VBAA_QUAL1_SAMPLES6("vbaa", "_allequal", 6),
- /** Pass-2: VBAA All-Equal, 8 samples */
- PASS2_VBAA_QUAL1_SAMPLES8("vbaa", "_allequal", 8);
+
+ /** Pass-2: VBAA Brute-Force, Odd, 1 samples */
+ PASS2_VBAA_QUAL1_SAMPLES1("vbaa", "_bforce_odd", 1),
+ /** Pass-2: VBAA Brute-Force, Even, 2 samples */
+ PASS2_VBAA_QUAL1_SAMPLES2("vbaa", "_bforce_even", 2),
+ /** Pass-2: VBAA Brute-Force, Odd, 3 samples */
+ PASS2_VBAA_QUAL1_SAMPLES3("vbaa", "_bforce_odd", 3),
+ /** Pass-2: VBAA Brute-Force, Even, 4 samples */
+ PASS2_VBAA_QUAL1_SAMPLES4("vbaa", "_bforce_even", 4),
+ /** Pass-2: VBAA Brute-Force, Odd, 5 samples */
+ PASS2_VBAA_QUAL1_SAMPLES5("vbaa", "_bforce_odd", 5),
+ /** Pass-2: VBAA Brute-Force, Even, 6 samples */
+ PASS2_VBAA_QUAL1_SAMPLES6("vbaa", "_bforce_even", 6),
+ /** Pass-2: VBAA Brute-Force, Odd, 7 samples */
+ PASS2_VBAA_QUAL1_SAMPLES7("vbaa", "_bforce_odd", 7),
+ /** Pass-2: VBAA Brute-Force, Even, 8 samples */
+ PASS2_VBAA_QUAL1_SAMPLES8("vbaa", "_bforce_even", 8);
public final String tech;
public final String sub;
@@ -361,14 +370,16 @@ public class RegionRenderer {
return PASS2_VBAA_QUAL0_SAMPLES8;
}
} else {
- if( sampleCount < 4 ) {
- return PASS2_VBAA_QUAL1_SAMPLES2;
- } else if( sampleCount < 6 ) {
- return PASS2_VBAA_QUAL1_SAMPLES4;
- } else if( sampleCount < 8 ) {
- return PASS2_VBAA_QUAL1_SAMPLES6;
- } else {
- return PASS2_VBAA_QUAL1_SAMPLES8;
+ switch( sampleCount ) {
+ case 0: // Fall through intended
+ case 1: return PASS2_VBAA_QUAL1_SAMPLES1;
+ case 2: return PASS2_VBAA_QUAL1_SAMPLES2;
+ case 3: return PASS2_VBAA_QUAL1_SAMPLES3;
+ case 4: return PASS2_VBAA_QUAL1_SAMPLES4;
+ case 5: return PASS2_VBAA_QUAL1_SAMPLES5;
+ case 6: return PASS2_VBAA_QUAL1_SAMPLES6;
+ case 7: return PASS2_VBAA_QUAL1_SAMPLES7;
+ default: return PASS2_VBAA_QUAL1_SAMPLES8;
}
}
} else {
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
index 090623444..24fa09058 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
@@ -167,7 +167,7 @@ public class VBORegion2PVBAAES2 extends GLRegion {
}
rsLocal.update(gl, rs, updateLocLocal, renderModes, false, true);
rs.updateUniformDataLoc(gl, updateLocLocal, false /* updateData */, gcu_FboTexUnit, true); // FIXME always update if changing tex-unit
- rs.updateUniformLoc(gl, updateLocLocal, gcu_FboTexSize, true);
+ rs.updateUniformLoc(gl, updateLocLocal, gcu_FboTexSize, sampleCount > 1); // maybe optimized away for sampleCount <= 1
}
}
@@ -576,7 +576,7 @@ public class VBORegion2PVBAAES2 extends GLRegion {
fbo.reset(gl, fboWidth, fboHeight);
// Shall not use bilinear (GL_LINEAR), due to own VBAA. Result is smooth w/o it now!
// FIXME: FXAA requires bilinear filtering!
- // texA = fbo.attachTexture2D(gl, 0, true, GL2ES2.GL_LINEAR, GL2ES2.GL_LINEAR, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE);
+ // texA = fbo.attachTexture2D(gl, 0, true, GL.GL_LINEAR, GL.GL_LINEAR, GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE);
texA = fbo.attachTexture2D(gl, 0, true, GL.GL_NEAREST, GL.GL_NEAREST, GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE);
if( !blendingEnabled ) {
// no depth-buffer w/ blending
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_bforce_even.glsl
index 0272c1f9f..ba7611a06 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_bforce_even.glsl
@@ -13,77 +13,77 @@
vec4 t;
// SampleCount 2 -> 4x
- t = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, -0.5)))*sample_weight; // NW
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, 0.5)))*sample_weight; // SW
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, 0.5)))*sample_weight; // SE
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, -0.5)))*sample_weight; // NE
+ t = texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-0.5, -0.5))*sample_weight; // NW
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-0.5, 0.5))*sample_weight; // SW
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 0.5, 0.5))*sample_weight; // SE
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 0.5, -0.5))*sample_weight; // NE
#if SAMPLE_COUNT > 2
// SampleCount 4 -> +12x = 16p
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, -1.5)))*sample_weight; // NW -> SW Edge
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, -0.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, 0.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, 1.5)))*sample_weight; // SW -> SE Edge
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, 1.5)))*sample_weight; //
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, 1.5)))*sample_weight; //
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, 1.5)))*sample_weight; // SE -> NE Edge
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, 0.5)))*sample_weight; //
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, -0.5)))*sample_weight; //
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, -1.5)))*sample_weight; // NE -> NW Edge
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, -1.5)))*sample_weight; //
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, -1.5)))*sample_weight; // NW - 1 (closed)
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-1.5, -1.5))*sample_weight; // NW -> SW Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-1.5, -0.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-1.5, 0.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-1.5, 1.5))*sample_weight; // SW -> SE Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-0.5, 1.5))*sample_weight; //
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 0.5, 1.5))*sample_weight; //
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 1.5, 1.5))*sample_weight; // SE -> NE Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 1.5, 0.5))*sample_weight; //
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 1.5, -0.5))*sample_weight; //
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 1.5, -1.5))*sample_weight; // NE -> NW Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 0.5, -1.5))*sample_weight; //
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-0.5, -1.5))*sample_weight; // NW - 1 (closed)
#if SAMPLE_COUNT > 4
// SampleCount 6 -> +20x = 36p
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, -2.5)))*sample_weight; // NW -> SW Edge
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, -1.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, -0.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, 0.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, 1.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, 2.5)))*sample_weight; // SW -> SE Edge
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, 2.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, 2.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, 2.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, 2.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, 2.5)))*sample_weight; // SE -> NE Edge
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, 1.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, 0.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, -0.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, -1.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, -2.5)))*sample_weight; // NE -> NW Edge
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, -2.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, -2.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, -2.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, -2.5)))*sample_weight; // NW - 1 (closed)
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-2.5, -2.5))*sample_weight; // NW -> SW Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-2.5, -1.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-2.5, -0.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-2.5, 0.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-2.5, 1.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-2.5, 2.5))*sample_weight; // SW -> SE Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-1.5, 2.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-0.5, 2.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 0.5, 2.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 1.5, 2.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 2.5, 2.5))*sample_weight; // SE -> NE Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 2.5, 1.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 2.5, 0.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 2.5, -0.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 2.5, -1.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 2.5, -2.5))*sample_weight; // NE -> NW Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 1.5, -2.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 0.5, -2.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-0.5, -2.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-1.5, -2.5))*sample_weight; // NW - 1 (closed)
#if SAMPLE_COUNT > 6
// SampleCount 8 -> +28x = 64p
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, -3.5)))*sample_weight; // NW -> SW Edge
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, -2.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, -1.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, -0.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, 0.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, 1.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, 2.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, 3.5)))*sample_weight; // SW -> SE Edge
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, 3.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, 3.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, 3.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, 3.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, 3.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, 3.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, 3.5)))*sample_weight; // SE -> NE Edge
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, 2.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, 1.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, 0.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, -0.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, -1.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, -2.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, -3.5)))*sample_weight; // NE -> NW Edge
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, -3.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, -3.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, -3.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, -3.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, -3.5)))*sample_weight;
- t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, -3.5)))*sample_weight; // NW - 1 (closed)
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-3.5, -3.5))*sample_weight; // NW -> SW Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-3.5, -2.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-3.5, -1.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-3.5, -0.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-3.5, 0.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-3.5, 1.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-3.5, 2.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-3.5, 3.5))*sample_weight; // SW -> SE Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-2.5, 3.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-1.5, 3.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-0.5, 3.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 0.5, 3.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 1.5, 3.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 2.5, 3.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 3.5, 3.5))*sample_weight; // SE -> NE Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 3.5, 2.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 3.5, 1.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 3.5, 0.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 3.5, -0.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 3.5, -1.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 3.5, -2.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 3.5, -3.5))*sample_weight; // NE -> NW Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 2.5, -3.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 1.5, -3.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 0.5, -3.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-0.5, -3.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-1.5, -3.5))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-2.5, -3.5))*sample_weight; // NW - 1 (closed)
#endif
#endif
#endif
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_bforce_odd.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_bforce_odd.glsl
new file mode 100644
index 000000000..7adf111d5
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_bforce_odd.glsl
@@ -0,0 +1,87 @@
+ // Pass-2: AA on Texture
+ // Note: gcv_FboTexCoord is in center of sample pixels.
+
+ // 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 vec4 tex_weights = vec4(0.075, 0.06, 0.045, 0.025);
+ vec2 texCoord = gcv_FboTexCoord.st;
+
+ vec4 t;
+
+ // SampleCount 1 -> 1x (raster 1x1)
+ t += texture2D(gcu_FboTexUnit, texCoord)*sample_weight; // CENTER
+
+ #if SAMPLE_COUNT > 1
+ // SampleCount 3 -> +8x = 9p (raster 3x3)
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-1.0, -1.0))*sample_weight; // top line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 0.0, -1.0))*sample_weight; // top line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 1.0, -1.0))*sample_weight; // top line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-1.0, 0.0))*sample_weight; // Center Left
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 1.0, 0.0))*sample_weight; // Center Right
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-1.0, 1.0))*sample_weight; // bottom line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 0.0, 1.0))*sample_weight; // bottom line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 1.0, 1.0))*sample_weight; // bottom line
+
+ #if SAMPLE_COUNT > 3
+ // SampleCount 5 -> +16x = 25p (raster 5x5)
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-2.0, -1.0))*sample_weight; // top line - 1
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 2.0, -1.0))*sample_weight; // top line - 1
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-2.0, 0.0))*sample_weight; // Center Left
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 2.0, 0.0))*sample_weight; // Center Right
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-2.0, 1.0))*sample_weight; // bottom line - 1
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 2.0, 1.0))*sample_weight; // bottom line - 1
+
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-2.0, -2.0))*sample_weight; // top line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-1.0, -2.0))*sample_weight; // top line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 0.0, -2.0))*sample_weight; // top line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 1.0, -2.0))*sample_weight; // top line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 2.0, -2.0))*sample_weight; // top line
+
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-2.0, 2.0))*sample_weight; // bottom line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-1.0, 2.0))*sample_weight; // bottom line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 0.0, 2.0))*sample_weight; // bottom line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 1.0, 2.0))*sample_weight; // bottom line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 2.0, 2.0))*sample_weight; // bottom line
+
+ #if SAMPLE_COUNT > 5
+ // SampleCount 7 -> +24x = 49p (raster 7x7)
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-3.0, -2.0))*sample_weight; // top line - 1
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 3.0, -2.0))*sample_weight; // top line - 1
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-3.0, -1.0))*sample_weight; // top line - 2
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 3.0, -1.0))*sample_weight; // top line - 2
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-3.0, 0.0))*sample_weight; // Center Left
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 3.0, 0.0))*sample_weight; // Center Right
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-3.0, 1.0))*sample_weight; // bottom line - 2
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 3.0, 1.0))*sample_weight; // bottom line - 2
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-3.0, 2.0))*sample_weight; // bottom line - 1
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 3.0, 2.0))*sample_weight; // bottom line - 1
+
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-3.0, -3.0))*sample_weight; // top line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-2.0, -3.0))*sample_weight; // top line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-1.0, -3.0))*sample_weight; // top line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 0.0, -3.0))*sample_weight; // top line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 1.0, -3.0))*sample_weight; // top line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 2.0, -3.0))*sample_weight; // top line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 3.0, -3.0))*sample_weight; // top line
+
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-3.0, 3.0))*sample_weight; // bottom line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-2.0, 3.0))*sample_weight; // bottom line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2(-1.0, 3.0))*sample_weight; // bottom line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 0.0, 3.0))*sample_weight; // bottom line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 1.0, 3.0))*sample_weight; // bottom line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 2.0, 3.0))*sample_weight; // bottom line
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*vec2( 3.0, 3.0))*sample_weight; // bottom line
+ #endif
+ #endif
+ #endif
+ #if 0
+ if(t.w == 0.0){
+ discard; // discard freezes NV tegra2 compiler
+ }
+ #endif
+
+ mgl_FragColor = t;
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java
index 45ed14f7b..784fe1009 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java
@@ -309,16 +309,12 @@ public class GPUUISceneGLListener0A implements GLEventListener {
int sampleCount = sceneUIController.getSampleCount();
if( shapeEvent.objPos[0] < shapeEvent.shape.getBounds().getCenter()[0] ) {
// left-half pressed
- if( sampleCount > 0 ) {
- sampleCount-=1;
- }
+ sampleCount--;
} else {
// right-half pressed
- if( sampleCount < 8 ) {
- sampleCount+=1;
- }
+ sampleCount++;
}
- sceneUIController.setSampleCount(sampleCount);
+ sampleCount = sceneUIController.setSampleCount(sampleCount); // validated / clipped
}
} } );
button.addMouseListener(dragZoomRotateListener);
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/SceneUIController.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/SceneUIController.java
index 008d4e038..3d4865b5d 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/SceneUIController.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/SceneUIController.java
@@ -99,7 +99,11 @@ public class SceneUIController implements GLEventListener{
}
public int getSampleCount() { return sampleCount[0]; }
- public void setSampleCount(final int v) { sampleCount[0]=v; markAllShapesDirty(); }
+ public int setSampleCount(final int v) {
+ sampleCount[0] = Math.min(8, Math.max(v, 1)); // clip
+ markAllShapesDirty();
+ return sampleCount[0];
+ }
public void setAllShapesQuality(final int q) {
for(int i=0; i<shapes.size(); i++) {