summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph/curve/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve/opengl')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java2
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java3
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java238
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java3
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl15
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm-weight.fp90
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm.fp44
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa-weight.fp118
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa.fp52
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa-weight.fp153
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa.fp83
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-lineAA.glsl20
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-simple.glsl21
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-simple.orig.glsl32
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-weight.glsl25
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_fxaa3.glsl56
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_bilin1.glsl92
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_equalweight.glsl50
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_propweight1.glsl66
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_wholeedge_equalweight.glsl98
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_wholeedge_propweight1.glsl114
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.vp12
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl2
23 files changed, 913 insertions, 476 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
index e50caa663..29483be58 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
@@ -47,7 +47,7 @@ public class RegionRendererImpl01 extends RegionRenderer {
@Override
protected final boolean initImpl(GL2ES2 gl) {
- final ShaderState st = rs.getShaderState();
+ final ShaderState st = getShaderState();
final ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, RegionRendererImpl01.class, "shader",
"shader/bin", getVertexShaderName(), true);
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
index 03ea91a32..79aa3d779 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
@@ -81,7 +81,7 @@ public class VBORegion2PMSAAES2 extends GLRegion {
indicesTxtBuffer = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
verticeTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
false, initialElementCount, GL.GL_STATIC_DRAW);
- texCoordTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT,
+ texCoordTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
false, initialElementCount, GL.GL_STATIC_DRAW);
}
@@ -109,6 +109,7 @@ public class VBORegion2PMSAAES2 extends GLRegion {
texCoordTxtAttr.putf(texParams[0]);
texCoordTxtAttr.putf(texParams[1]);
+ texCoordTxtAttr.putf(texParams[2]);
}
@Override
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
index 6f9ef107b..e8c0a6b66 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
@@ -36,6 +36,7 @@ import javax.media.opengl.fixedfunc.GLMatrixFunc;
import jogamp.graph.curve.opengl.shader.AttributeNames;
import jogamp.graph.curve.opengl.shader.UniformNames;
+import jogamp.opengl.Debug;
import com.jogamp.common.nio.Buffers;
import com.jogamp.graph.curve.Region;
@@ -53,6 +54,37 @@ import com.jogamp.opengl.util.glsl.ShaderState;
public class VBORegion2PVBAAES2 extends GLRegion {
private static final boolean DEBUG_FBO_1 = false;
private static final boolean DEBUG_FBO_2 = false;
+
+ /**
+ * Boundary triggering FBO resize if
+ * <pre>
+ * fbo[Width|Height] - targetFbo[Width|Height] > RESIZE_BOUNDARY.
+ * </pre>
+ * <p>
+ * Increasing the FBO will add RESIZE_BOUNDARY/2.
+ * </p>
+ * <p>
+ * Reducing FBO resize to gain performance.
+ * </p>
+ * <p>
+ * Defaults to disabled since:
+ * - not working properly
+ * - FBO texture rendered > than desired size
+ * - FBO resize itself should be fast enough ?!
+ * </p>
+ */
+ private static final int RESIZE_BOUNDARY;
+
+ static {
+ Debug.initSingleton();
+ final String key = "jogl.debug.graph.curve.vbaa.resizeLowerBoundary";
+ RESIZE_BOUNDARY = Math.max(0, Debug.getIntProperty(key, true, 0));
+ if( RESIZE_BOUNDARY > 0 ) {
+ System.err.println("key: "+RESIZE_BOUNDARY);
+ }
+ }
+
+
private GLArrayDataServer verticeTxtAttr;
private GLArrayDataServer texCoordTxtAttr;
private GLArrayDataServer indicesTxtBuffer;
@@ -67,6 +99,7 @@ public class VBORegion2PVBAAES2 extends GLRegion {
private int fboWidth = 0;
private int fboHeight = 0;
+ private boolean fboDirty = true;
GLUniformData mgl_ActiveTexture;
GLUniformData mgl_TextureSize;
@@ -82,7 +115,7 @@ public class VBORegion2PVBAAES2 extends GLRegion {
indicesTxtBuffer = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
verticeTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
false, initialElementCount, GL.GL_STATIC_DRAW);
- texCoordTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT,
+ texCoordTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
false, initialElementCount, GL.GL_STATIC_DRAW);
}
@@ -104,6 +137,7 @@ public class VBORegion2PVBAAES2 extends GLRegion {
texCoordTxtAttr.seal(gl, false);
texCoordTxtAttr.rewind();
}
+ fboDirty = true;
}
@Override
@@ -114,6 +148,7 @@ public class VBORegion2PVBAAES2 extends GLRegion {
texCoordTxtAttr.putf(texParams[0]);
texCoordTxtAttr.putf(texParams[1]);
+ texCoordTxtAttr.putf(texParams[2]);
}
@Override
@@ -177,15 +212,14 @@ public class VBORegion2PVBAAES2 extends GLRegion {
indicesFbo.seal(gl, true);
indicesFbo.enableBuffer(gl, false);
- // trigger renderRegion2FBO !
- fboHeight = 0;
- fboWidth = 0;
+ fboDirty = true;
// the buffers were disabled, since due to real/fbo switching and other vbo usage
}
private final AABBox drawWinBox = new AABBox();
private final int[] drawView = new int[] { 0, 0, 0, 0 };
private final float[] drawTmpV3 = new float[3];
+ private final int border = 2; // surrounding border, i.e. width += 2*border, height +=2*border
@Override
protected void drawImpl(final GL2ES2 gl, final RegionRenderer renderer, final int[/*1*/] sampleCount) {
@@ -201,9 +235,9 @@ public class VBORegion2PVBAAES2 extends GLRegion {
}
return; // inf
}
- final int width = renderer.getWidth();
- final int height = renderer.getHeight();
- if(width <=0 || height <= 0 || null==sampleCount || sampleCount[0] <= 0){
+ final int vpWidth = renderer.getWidth();
+ final int vpHeight = renderer.getHeight();
+ if(vpWidth <=0 || vpHeight <= 0 || null==sampleCount || sampleCount[0] <= 0){
renderRegion(gl);
} else {
if(0 > maxTexSize[0]) {
@@ -211,31 +245,62 @@ public class VBORegion2PVBAAES2 extends GLRegion {
}
final RenderState rs = renderer.getRenderState();
final float winWidth, winHeight;
+
+ final float ratioObjWinWidth, ratioObjWinHeight;
+ final float diffObjWidth, diffObjHeight;
+ final float diffObjBorderWidth, diffObjBorderHeight;
int targetFboWidth, targetFboHeight;
- float renderFboWidth, renderFboHeight;
- float diffWidth, diffHeight;
{
+ final float diffWinWidth, diffWinHeight;
+ final int targetWinWidth, targetWinHeight;
+
// Calculate perspective pixel width/height for FBO,
// considering the sampleCount.
- drawView[2] = width;
- drawView[3] = height;
+ drawView[2] = vpWidth;
+ drawView[3] = vpHeight;
box.mapToWindow(drawWinBox, renderer.getMatrix(), drawView, true /* useCenterZ */, drawTmpV3);
winWidth = drawWinBox.getWidth();
winHeight = drawWinBox.getHeight();
- diffWidth = (float)Math.ceil(winWidth)-winWidth;
- diffHeight = (float)Math.ceil(winHeight)-winHeight;
- renderFboWidth = winWidth*sampleCount[0];
- renderFboHeight = winHeight*sampleCount[0];
- targetFboWidth = (int)Math.ceil(renderFboWidth);
- targetFboHeight = (int)Math.ceil(renderFboHeight);
+ targetWinWidth = (int)Math.ceil(winWidth);
+ targetWinHeight = (int)Math.ceil(winHeight);
+ diffWinWidth = targetWinWidth-winWidth;
+ diffWinHeight = targetWinHeight-winHeight;
+
+ ratioObjWinWidth = box.getWidth() / winWidth;
+ ratioObjWinHeight= box.getHeight() / winHeight;
+ diffObjWidth = diffWinWidth * ratioObjWinWidth;
+ diffObjHeight = diffWinHeight * ratioObjWinHeight;
+ diffObjBorderWidth = border * ratioObjWinWidth;
+ diffObjBorderHeight = border * ratioObjWinHeight;
+
+ targetFboWidth = (targetWinWidth+2*border)*sampleCount[0];
+ targetFboHeight = (targetWinHeight+2*border)*sampleCount[0];
+
if( DEBUG_FBO_2 ) {
+ final float ratioWinWidth, ratioWinHeight;
+ ratioWinWidth = winWidth/targetWinWidth;
+ ratioWinHeight = winHeight/targetWinHeight;
+ final float renderFboWidth, renderFboHeight;
+ renderFboWidth = (winWidth+2*border)*sampleCount[0];
+ renderFboHeight = (winHeight+2*border)*sampleCount[0];
+ final float ratioFboWidth, ratioFboHeight;
+ ratioFboWidth = renderFboWidth/targetFboWidth;
+ ratioFboHeight = renderFboHeight/targetFboHeight;
+ final float diffFboWidth, diffFboHeight;
+ diffFboWidth = targetFboWidth-renderFboWidth;
+ diffFboHeight = targetFboHeight-renderFboHeight;
+
System.err.printf("XXX.MinMax obj %s%n", box.toString());
+ System.err.printf("XXX.MinMax obj d[%.3f, %.3f], r[%f, %f], b[%f, %f]%n",
+ diffObjWidth, diffObjHeight, ratioObjWinWidth, ratioObjWinWidth, diffObjBorderWidth, diffObjBorderHeight);
System.err.printf("XXX.MinMax win %s%n", drawWinBox.toString());
- System.err.printf("XXX.MinMax view[%d, %d] -> win[%.3f, %.3f]: FBO f[%.3f, %.3f], i[%d x %d], d[%.3f, %.3f], msaa %d%n",
+ System.err.printf("XXX.MinMax view[%d, %d] -> win[%.3f, %.3f], i[%d x %d], d[%.3f, %.3f], r[%f, %f]: FBO f[%.3f, %.3f], i[%d x %d], d[%.3f, %.3f], r[%f, %f], samples %d%n",
drawView[2], drawView[3],
- winWidth, winHeight,
+ winWidth, winHeight, targetWinWidth, targetWinHeight, diffWinWidth,
+ diffWinHeight, ratioWinWidth, ratioWinHeight,
renderFboWidth, renderFboHeight, targetFboWidth, targetFboHeight,
- diffWidth, diffHeight, sampleCount[0]);
+ diffFboWidth, diffFboHeight, ratioFboWidth, ratioFboHeight,
+ sampleCount[0]);
}
}
if( 0 >= targetFboWidth || 0 >= targetFboHeight ) {
@@ -244,33 +309,24 @@ public class VBORegion2PVBAAES2 extends GLRegion {
}
final int deltaFboWidth = Math.abs(targetFboWidth-fboWidth);
final int deltaFboHeight = Math.abs(targetFboHeight-fboHeight);
- final int maxDeltaFbo, maxLengthFbo;
- if( deltaFboWidth >= deltaFboHeight ) {
- maxDeltaFbo = deltaFboWidth;
- maxLengthFbo = fboWidth > 0 ? fboWidth : 1;
- } else {
- maxDeltaFbo = deltaFboHeight;
- maxLengthFbo = fboHeight > 0 ? fboHeight : 1;
- }
- final float pctFboDelta = (float)maxDeltaFbo / (float)maxLengthFbo;
+ final boolean hasDelta = 0!=deltaFboWidth || 0!=deltaFboHeight;
if( DEBUG_FBO_2 ) {
- System.err.printf("XXX.maxDelta: %d / %d = %.3f%n", maxDeltaFbo, maxLengthFbo, pctFboDelta);
+ System.err.printf("XXX.maxDelta: hasDelta %b: %d / %d, %.3f, %.3f%n",
+ hasDelta, deltaFboWidth, deltaFboHeight, (float)deltaFboWidth/fboWidth, (float)deltaFboHeight/fboHeight);
+ System.err.printf("XXX.Scale %d * [%f x %f]: %d x %d%n",
+ sampleCount[0], winWidth, winHeight, targetFboWidth, targetFboHeight);
}
- if( pctFboDelta > 0.1f ) { // more than 10% !
- if( DEBUG_FBO_1 ) {
- System.err.printf("XXX.maxDelta: %d / %d = %.3f%n", maxDeltaFbo, maxLengthFbo, pctFboDelta);
- System.err.printf("XXX.Scale %d * [%f x %f]: %d x %d%n",
- sampleCount[0], winWidth, winHeight, targetFboWidth, targetFboHeight);
- }
+ if( hasDelta || fboDirty || null == fbo ) {
final int maxLength = Math.max(targetFboWidth, targetFboHeight);
if( maxLength > maxTexSize[0] ) {
if( targetFboWidth > targetFboHeight ) {
- sampleCount[0] = (int)Math.floor(maxTexSize[0] / winWidth);
+ sampleCount[0] = (int)Math.floor(maxTexSize[0] / (winWidth+2*border));
} else {
- sampleCount[0] = (int)Math.floor(maxTexSize[0] / winHeight);
+ sampleCount[0] = (int)Math.floor(maxTexSize[0] / (winHeight+2*border));
}
- renderFboWidth = winWidth*sampleCount[0];
- renderFboHeight = winHeight*sampleCount[0];
+ final float renderFboWidth, renderFboHeight;
+ renderFboWidth = (winWidth+2*border)*sampleCount[0];
+ renderFboHeight = (winWidth+2*border)*sampleCount[0];
targetFboWidth = (int)Math.ceil(renderFboWidth);
targetFboHeight = (int)Math.ceil(renderFboHeight);
if( DEBUG_FBO_1 ) {
@@ -284,44 +340,92 @@ public class VBORegion2PVBAAES2 extends GLRegion {
return;
}
}
+
+ final int newFboWidth, newFboHeight, resizeCase;
+ if( 0 >= RESIZE_BOUNDARY ) {
+ // Resize w/o optimization
+ newFboWidth = targetFboWidth;
+ newFboHeight = targetFboHeight;
+ resizeCase = 0;
+ } else {
+ if( 0 >= fboWidth || 0 >= fboHeight || null == fbo ) {
+ // Case: New FBO
+ newFboWidth = targetFboWidth;
+ newFboHeight = targetFboHeight;
+ resizeCase = 1;
+ } else if( targetFboWidth > fboWidth || targetFboHeight > fboHeight ) {
+ // Case: Inscrease FBO Size, add boundary/2 if avail
+ newFboWidth = ( targetFboWidth + RESIZE_BOUNDARY/2 < maxTexSize[0] ) ? targetFboWidth + RESIZE_BOUNDARY/2 : targetFboWidth;
+ newFboHeight = ( targetFboHeight+ RESIZE_BOUNDARY/2 < maxTexSize[0] ) ? targetFboHeight + RESIZE_BOUNDARY/2 : targetFboHeight;
+ resizeCase = 2;
+ } else if( targetFboWidth < fboWidth && targetFboHeight < fboHeight &&
+ fboWidth - targetFboWidth < RESIZE_BOUNDARY &&
+ fboHeight - targetFboHeight < RESIZE_BOUNDARY ) {
+ // Case: Decreased FBO Size Request within boundary
+ newFboWidth = fboWidth;
+ newFboHeight = fboHeight;
+ resizeCase = 3;
+ } else {
+ // Case: Decreased-Size-Beyond-Boundary or No-Resize
+ newFboWidth = targetFboWidth;
+ newFboHeight = targetFboHeight;
+ resizeCase = 4;
+ }
+ }
+ final int dResizeWidth = newFboWidth - targetFboWidth;
+ final int dResizeHeight = newFboHeight - targetFboHeight;
+ final float diffObjResizeWidth = dResizeWidth*ratioObjWinWidth;
+ final float diffObjResizeHeight = dResizeHeight*ratioObjWinHeight;
+ if( DEBUG_FBO_1 ) {
+ System.err.printf("XXX.resizeFBO: case %d, has %dx%d > target %dx%d, resize: i[%d x %d], f[%.3f x %.3f] -> %dx%d%n",
+ resizeCase, fboWidth, fboHeight, targetFboWidth, targetFboHeight,
+ dResizeWidth, dResizeHeight, diffObjResizeWidth, diffObjResizeHeight,
+ newFboWidth, newFboHeight);
+ }
+
+ final float minX = box.getMinX()-diffObjBorderWidth;
+ final float minY = box.getMinY()-diffObjBorderHeight;
+ final float maxX = box.getMaxX()+diffObjBorderWidth+diffObjWidth+diffObjResizeWidth;
+ final float maxY = box.getMaxY()+diffObjBorderHeight+diffObjHeight+diffObjResizeHeight;
verticeFboAttr.seal(false);
- verticeFboAttr.rewind();
- verticeFboAttr.putf(box.getMinX()); verticeFboAttr.putf(box.getMinY()); verticeFboAttr.putf(box.getMinZ());
- verticeFboAttr.putf(box.getMinX()); verticeFboAttr.putf(box.getMaxY()+diffHeight); verticeFboAttr.putf(box.getMinZ());
- verticeFboAttr.putf(box.getMaxX()+diffWidth); verticeFboAttr.putf(box.getMaxY()+diffHeight); verticeFboAttr.putf(box.getMinZ());
- verticeFboAttr.putf(box.getMaxX()+diffWidth); verticeFboAttr.putf(box.getMinY()); verticeFboAttr.putf(box.getMinZ());
+ {
+ final FloatBuffer fb = (FloatBuffer)verticeFboAttr.getBuffer();
+ fb.put(0, minX); fb.put( 1, minY);
+ fb.put(3, minX); fb.put( 4, maxY);
+ fb.put(6, maxX); fb.put( 7, maxY);
+ fb.put(9, maxX); fb.put(10, minY);
+ }
verticeFboAttr.seal(true);
fboPMVMatrix.glLoadIdentity();
- fboPMVMatrix.glOrthof(box.getMinX(), box.getMaxX()+diffWidth,
- box.getMinY(), box.getMaxY()+diffHeight, -1, 1);
- renderRegion2FBO(gl, rs, targetFboWidth, targetFboHeight, sampleCount[0]);
+ fboPMVMatrix.glOrthof(minX, maxX, minY, maxY, -1, 1);
+ renderRegion2FBO(gl, rs, targetFboWidth, targetFboHeight, newFboWidth, newFboHeight, vpWidth, vpHeight, sampleCount[0]);
}
- // System.out.println("Scale: " + matrix.glGetMatrixf().get(1+4*3) +" " + matrix.glGetMatrixf().get(2+4*3));
- renderFBO(gl, rs, width, height, sampleCount[0]);
+ renderFBO(gl, rs, targetFboWidth, targetFboHeight, vpWidth, vpHeight, sampleCount[0]);
}
}
- private void setTexSize(final GL2ES2 gl, final ShaderState st, boolean firstPass, int sampleCount) {
+ private void setTexSize(final GL2ES2 gl, final ShaderState st, boolean firstPass, int width, int height, int sampleCount) {
if(null == mgl_TextureSize) {
mgl_TextureSize = new GLUniformData(UniformNames.gcu_TextureSize, 3, Buffers.newDirectFloatBuffer(3));
}
final FloatBuffer texSize = (FloatBuffer) mgl_TextureSize.getBuffer();
+ texSize.put(0, width);
+ texSize.put(1, height);
if( firstPass ) {
texSize.put(2, 0f);
} else {
- texSize.put(0, fboWidth);
- texSize.put(1, fboHeight);
texSize.put(2, sampleCount);
}
st.uniform(gl, mgl_TextureSize);
}
- private void renderFBO(final GL2ES2 gl, final RenderState rs, final int width, final int height, int sampleCount) {
+ private void renderFBO(final GL2ES2 gl, final RenderState rs, final int targetFboWidth, final int targetFboHeight,
+ final int vpWidth, final int vpHeight, int sampleCount) {
final ShaderState st = rs.getShaderState();
- gl.glViewport(0, 0, width, height);
+ gl.glViewport(0, 0, vpWidth, vpHeight);
st.uniform(gl, mgl_ActiveTexture);
gl.glActiveTexture(GL.GL_TEXTURE0 + mgl_ActiveTexture.intValue());
- setTexSize(gl, st, false, sampleCount);
+ setTexSize(gl, st, false, fboWidth, fboHeight, sampleCount);
fbo.use(gl, texA);
verticeFboAttr.enableBuffer(gl, true);
@@ -338,7 +442,9 @@ public class VBORegion2PVBAAES2 extends GLRegion {
// setback: gl.glActiveTexture(currentActiveTextureEngine[0]);
}
- private void renderRegion2FBO(final GL2ES2 gl, final RenderState rs, final int targetFboWidth, final int targetFboHeight, int sampleCount) {
+ private void renderRegion2FBO(final GL2ES2 gl, final RenderState rs,
+ final int targetFboWidth, final int targetFboHeight, final int newFboWidth, final int newFboHeight,
+ final int vpWidth, final int vpHeight, final int sampleCount) {
final ShaderState st = rs.getShaderState();
if( 0 >= targetFboWidth || 0 >= targetFboHeight ) {
@@ -346,29 +452,30 @@ public class VBORegion2PVBAAES2 extends GLRegion {
}
if(null == fbo) {
- fboWidth = targetFboWidth;
- fboHeight = targetFboHeight;
+ fboWidth = newFboWidth;
+ fboHeight = newFboHeight;
fbo = new FBObject();
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, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE);
fbo.attachRenderbuffer(gl, Attachment.Type.DEPTH, 24);
if( DEBUG_FBO_1 ) {
System.err.printf("XXX.createFBO: %dx%d%n%s%n", fboWidth, fboHeight, fbo.toString());
}
- } else if( targetFboWidth != fboWidth || targetFboHeight != fboHeight ) {
- fbo.reset(gl, targetFboWidth, targetFboHeight);
+ } else if( newFboWidth != fboWidth || newFboHeight != fboHeight ) {
+ fbo.reset(gl, newFboWidth, newFboHeight);
fbo.bind(gl);
if( DEBUG_FBO_1 ) {
- System.err.printf("XXX.resetFBO: %dx%d -> %dx%d%n%s%n", fboWidth, fboHeight, targetFboWidth, targetFboHeight, fbo );
+ System.err.printf("XXX.resetFBO: %dx%d -> %dx%d, target %dx%d%n", fboWidth, fboHeight, newFboWidth, newFboHeight, targetFboWidth, targetFboHeight);
}
- fboWidth = targetFboWidth;
- fboHeight = targetFboHeight;
+ fboWidth = newFboWidth;
+ fboHeight = newFboHeight;
} else {
fbo.bind(gl);
}
- setTexSize(gl, st, true, sampleCount);
+ setTexSize(gl, st, true, vpWidth, vpHeight, sampleCount);
//render texture
gl.glViewport(0, 0, fboWidth, fboHeight);
@@ -377,6 +484,7 @@ public class VBORegion2PVBAAES2 extends GLRegion {
gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT | GL2ES2.GL_DEPTH_BUFFER_BIT);
renderRegion(gl);
fbo.unbind(gl);
+ fboDirty = false;
st.uniform(gl, rs.getPMVMatrix()); // switch back to real PMV matrix
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
index baeb8dc46..cf85628ad 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
@@ -51,7 +51,7 @@ public class VBORegionSPES2 extends GLRegion {
verticeAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
false, initialElementCount, GL.GL_STATIC_DRAW);
- texCoordAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT,
+ texCoordAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
false, initialElementCount, GL.GL_STATIC_DRAW);
}
@@ -82,6 +82,7 @@ public class VBORegionSPES2 extends GLRegion {
texCoordAttr.putf(texParams[0]);
texCoordAttr.putf(texParams[1]);
+ texCoordAttr.putf(texParams[2]);
}
@Override
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl
index 108247c9c..c4d9db535 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl
@@ -4,7 +4,20 @@
// attribute vec3 gca_Vertices;
attribute vec4 gca_Vertices;
-attribute vec2 gca_TexCoords;
+
+/**
+ * CDTriangulator2D.extractBoundaryTriangles(..):
+ * AA line (exp) : z > 0
+ * line : x == 0, y == 0
+ * hole or holeLike: 0 > y
+ * !hole : 0 < y
+ *
+ * 0 == gcv_TexCoord.x : vertex-0 of triangle
+ * 0.5 == gcv_TexCoord.x : vertex-1 of triangle
+ * 1 == gcv_TexCoord.x : vertex-2 of triangle
+ */
+attribute vec3 gca_TexCoords;
+
//attribute vec4 gca_Colors;
//attribute vec3 gca_Normals;
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm-weight.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm-weight.fp
index 940e95071..20acfbac6 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm-weight.fp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm-weight.fp
@@ -1,62 +1,28 @@
-//Copyright 2010 JogAmp Community. All rights reserved.
-
-//
-// 1-pass shader w/ weight
-//
-
-#if __VERSION__ >= 130
- #define varying in
- out vec4 mgl_FragColor;
-#else
- #define mgl_FragColor gl_FragColor
-#endif
-
-#include uniforms.glsl
-#include varyings.glsl
-
-const vec3 zero3 = vec3(0);
-
-void main (void)
-{
- vec3 c;
- float alpha;
-
- vec2 rtex = vec2(abs(gcv_TexCoord.x),abs(gcv_TexCoord.y));
-
- if( gcv_TexCoord.x == 0.0 && gcv_TexCoord.y == 0.0 ) {
- // pass-1: Lines
- c = gcu_ColorStatic.rgb;
- alpha = gcu_Alpha;
- } else if ( gcv_TexCoord.x > 0.0 && ( rtex.y > 0.0 || rtex.x == 1.0 ) ) {
- // pass-1: curves
- rtex.y -= 0.1;
-
- if(rtex.y < 0.0 && gcv_TexCoord.y < 0.0) {
- // discard; // freezes NV tegra2 compiler
- c = zero3;
- alpha = 0.0;
- } else {
- rtex.y = max(rtex.y, 0.0);
-
- vec2 dtx = dFdx(rtex);
- vec2 dty = dFdy(rtex);
-
- float w = gcu_Weight;
- float pd = ((2.0 - (2.0*w))*rtex.x*rtex.x) + 2.0*(w-1.0)*rtex.x + 1.0;
- float position = rtex.y - ((w*rtex.x*(1.0 - rtex.x))/pd);
-
- 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.0*rtex.x))/gd), (dty.y - (w*dty.x*(1.0 - 2.0*rtex.x))/gd));
-
- c = gcu_ColorStatic.rgb;
- alpha = gcu_Alpha * clamp(0.5 - ( position/length(f) ) * sign(gcv_TexCoord.y), 0.0, 1.0);
- }
- } else {
- c = zero3;
- alpha = 0.0;
- }
-
- mgl_FragColor = vec4(c, alpha);
-}
+//Copyright 2010 JogAmp Community. All rights reserved.
+
+//
+// 1-pass shader w/o weight
+//
+
+#if __VERSION__ >= 130
+ #define varying in
+ out vec4 mgl_FragColor;
+#else
+ #define mgl_FragColor gl_FragColor
+#endif
+
+#include uniforms.glsl
+#include varyings.glsl
+
+const vec3 zero3 = vec3(0);
+
+void main (void)
+{
+ vec3 color;
+ float alpha;
+
+// #include curverenderer01-pass1-curve-lineAA.glsl
+#include curverenderer01-pass1-curve-weight.glsl
+
+ mgl_FragColor = vec4(color, gcu_Alpha * alpha);
+}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm.fp
index 2175c1a31..03d2f9408 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm.fp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm.fp
@@ -18,47 +18,11 @@ const vec3 zero3 = vec3(0);
void main (void)
{
- vec3 c;
+ vec3 color;
float alpha;
- /**
- * CDTriangulator2D.extractBoundaryTriangles(..):
- * 0 > gcv_TexCoord.y : hole or holeLike
- * 0 < gcv_TexCoord.y : !hole (outer)
- *
- * 0 == gcv_TexCoord.x : vertex-0 of triangle
- * 0.5 == gcv_TexCoord.x : vertex-1 of triangle
- * 1 == gcv_TexCoord.x : vertex-2 of triangle
- */
- vec2 rtex = vec2(abs(gcv_TexCoord.x),abs(gcv_TexCoord.y));
-
- if( gcv_TexCoord.x == 0.0 && gcv_TexCoord.y == 0.0 ) {
- // pass-1: Lines
- c = gcu_ColorStatic.rgb;
- alpha = gcu_Alpha;
- } else if ( gcv_TexCoord.x > 0.0 && ( rtex.y > 0.0 || rtex.x == 1.0 ) ) {
- // pass-1: curves
- rtex.y -= 0.1;
-
- if(rtex.y < 0.0 && gcv_TexCoord.y < 0.0) {
- // discard; // freezes NV tegra2 compiler
- c = zero3;
- alpha = 0.0;
- } else {
- rtex.y = max(rtex.y, 0.0);
+// #include curverenderer01-pass1-curve-lineAA.glsl
+#include curverenderer01-pass1-curve-simple.glsl
- vec2 dtx = dFdx(rtex);
- vec2 dty = dFdy(rtex);
-
- 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));
-
- c = gcu_ColorStatic.rgb;
- alpha = gcu_Alpha * clamp(0.5 - ( position/length(f) ) * sign(gcv_TexCoord.y), 0.0, 1.0);
- }
- } else {
- c = zero3;
- alpha = 0.0;
- }
- mgl_FragColor = vec4(c, alpha);
+ mgl_FragColor = vec4(color, gcu_Alpha * alpha);
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa-weight.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa-weight.fp
index 733669e64..1c5688880 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa-weight.fp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa-weight.fp
@@ -1,76 +1,42 @@
-//Copyright 2010 JogAmp Community. All rights reserved.
-
-//
-// 2-pass shader w/ weight
-//
-
-#if __VERSION__ >= 130
- #define varying in
- out vec4 mgl_FragColor;
- #define texture2D texture
-#else
- #define mgl_FragColor gl_FragColor
-#endif
-
-#include uniforms.glsl
-#include varyings.glsl
-
-const vec3 zero3 = vec3(0);
-
-void main (void)
-{
- vec3 c;
- float alpha;
-
- if( 0 < gcu_TextureSize.z ) {
- // Pass-2: Dump Texture
- vec4 t = texture2D(gcu_TextureUnit, gcv_TexCoord);
- #if 0
- if( 0.0 == t.a ) {
- discard; // discard freezes NV tegra2 compiler
- }
- #endif
-
- c = t.rgb;
- alpha = gcu_Alpha * t.a;
- } else {
- // Pass-1
- vec2 rtex = vec2(abs(gcv_TexCoord.x),abs(gcv_TexCoord.y));
-
- if( gcv_TexCoord.x == 0.0 && gcv_TexCoord.y == 0.0 ) {
- // pass-1: Lines
- c = gcu_ColorStatic.rgb;
- alpha = 1.0;
- } else if ( gcv_TexCoord.x > 0.0 && (rtex.y > 0.0 || rtex.x == 1.0) ) {
- // pass-1: curves
- rtex.y -= 0.1;
-
- if(rtex.y < 0.0 && gcv_TexCoord.y < 0.0) {
- // discard; // freezes NV tegra2 compiler
- c = zero3;
- alpha = 0.0;
- } else {
- rtex.y = max(rtex.y, 0.0);
-
- vec2 dtx = dFdx(rtex);
- vec2 dty = dFdy(rtex);
-
- float w = gcu_Weight;
- float pd = ((2.0 - (2.0*w))*rtex.x*rtex.x) + 2.0*(w-1.0)*rtex.x + 1.0;
- float position = rtex.y - ((w*rtex.x*(1.0 - rtex.x))/pd);
-
- 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.0*rtex.x))/gd), (dty.y - (w*dty.x*(1.0 - 2.0*rtex.x))/gd));
-
- c = gcu_ColorStatic.rgb;
- alpha = clamp(0.5 - ( position/length(f) ) * sign(gcv_TexCoord.y), 0.0, 1.0);
- }
- } else {
- c = zero3;
- alpha = 0.0;
- }
- }
- mgl_FragColor = vec4(c, alpha);
-}
+//Copyright 2010 JogAmp Community. All rights reserved.
+
+//
+// 2-pass shader w/ weight
+//
+
+#if __VERSION__ >= 130
+ #define varying in
+ out vec4 mgl_FragColor;
+ #define texture2D texture
+#else
+ #define mgl_FragColor gl_FragColor
+#endif
+
+#include uniforms.glsl
+#include varyings.glsl
+
+const vec3 zero3 = vec3(0);
+
+void main (void)
+{
+ vec3 color;
+ float alpha;
+
+ if( 0 < gcu_TextureSize.z ) {
+ // Pass-2: Dump Texture
+ vec4 t = texture2D(gcu_TextureUnit, gcv_TexCoord.st);
+ #if 0
+ if( 0.0 == t.a ) {
+ discard; // discard freezes NV tegra2 compiler
+ }
+ #endif
+
+ c = t.rgb;
+ alpha = gcu_Alpha * t.a;
+ } else {
+
+#include curverenderer01-pass1-curve-weight.glsl
+
+ }
+ mgl_FragColor = vec4(c, alpha);
+}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa.fp
index 2536e251b..b78e11585 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa.fp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa.fp
@@ -15,25 +15,23 @@
#include uniforms.glsl
#include varyings.glsl
-// #define PREALPHA 1
-
const vec3 zero3 = vec3(0);
void main (void)
{
- vec3 c;
+ vec3 color;
float alpha;
-
+
if( 0 < gcu_TextureSize.z ) {
// Pass-2: Dump Texture
- vec4 t = texture2D(gcu_TextureUnit, gcv_TexCoord);
+ vec4 t = texture2D(gcu_TextureUnit, gcv_TexCoord.st);
#if 0
if( 0.0 == t.a ) {
discard; // discard freezes NV tegra2 compiler
}
#endif
- c = t.rgb;
+ color = t.rgb;
#ifdef PREALPHA
// alpha = mix(0.0, gcu_Alpha, t.a); // t.a one of [ 0.0, 1.0 ]
// ^^ for = 0.0 == t.a ? 0.0 : gcu_Alpha;
@@ -43,46 +41,10 @@ void main (void)
alpha = gcu_Alpha * t.a;
#endif
} else {
- // Pass-1
- vec2 rtex = vec2(abs(gcv_TexCoord.x),abs(gcv_TexCoord.y));
-
- if( gcv_TexCoord.x == 0.0 && gcv_TexCoord.y == 0.0 ) {
- // pass-1: Lines
- c = gcu_ColorStatic.rgb;
- alpha = 1.0;
- } else if ( gcv_TexCoord.x > 0.0 && (rtex.y > 0.0 || rtex.x == 1.0) ) {
- // pass-1: curves
- rtex.y -= 0.1;
-
- if(rtex.y < 0.0 && gcv_TexCoord.y < 0.0) {
- // discard; // freezes NV tegra2 compiler
- c = zero3;
- alpha = 0.0;
- } else {
- rtex.y = max(rtex.y, 0.0);
- vec2 dtx = dFdx(rtex);
- vec2 dty = dFdy(rtex);
-
- 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));
+#include curverenderer01-pass1-curve-simple.glsl
- #ifdef PREALPHA
- float a = clamp(0.5 - ( position/length(f) ) * sign(gcv_TexCoord.y), 0.0, 1.0);
- c = gcu_ColorStatic.rgb * a;
- alpha = mix(1.0, 0.0, step(a, 0.0));
- // ^^ = 0.0 < a ? 1.0 : 0.0;
- // step(e, x) := e > x ? 0.0 : 1.0
- // mix(x, y, a) := x * ( 1 - a ) + y * a
- #else
- c = gcu_ColorStatic.rgb;
- alpha = clamp(0.5 - ( position/length(f) ) * sign(gcv_TexCoord.y), 0.0, 1.0);
- #endif
- }
- } else {
- c = zero3;
- alpha = 0.0;
- }
}
- mgl_FragColor = vec4(c, alpha);
+ mgl_FragColor = vec4(color, alpha);
}
+
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa-weight.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa-weight.fp
index 3b1b55c87..36767b658 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa-weight.fp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa-weight.fp
@@ -1,109 +1,44 @@
-//Copyright 2010 JogAmp Community. All rights reserved.
-
-//
-// 2-pass shader w/ weight
-//
-
-#if __VERSION__ >= 130
- #define varying in
- out vec4 mgl_FragColor;
- #define texture2D texture
-#else
- #define mgl_FragColor gl_FragColor
-#endif
-
-#include uniforms.glsl
-#include varyings.glsl
-
-const vec3 zero3 = vec3(0);
-
-void main (void)
-{
- vec3 c;
- float alpha;
-
- if( 0 < gcu_TextureSize.z ) {
- // Pass-2: AA on Texture
- // Note: gcv_TexCoord is in center of sample pixels.
-
- float sampleCount = gcu_TextureSize.z;
- vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size
-
- float sample_weight = 1 / ( 2 * sampleCount );
- // float sample_weight = 1 / ( 2 * sampleCount + 1 );
-
- vec4 t = vec4(0);
- // vec4 t = texture2D(gcu_TextureUnit, gcv_TexCoord)* sample_weight; // center: +1
-
- // SampleCount 2
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2(-0.5, -0.5)))*sample_weight; // NW
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2(-0.5, 0.5)))*sample_weight; // SW
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2( 0.5, 0.5)))*sample_weight; // SE
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2( 0.5, -0.5)))*sample_weight; // NE
- if( sampleCount > 2 ) {
- // SampleCount 4
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2(-1.5, -1.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2(-1.5, 1.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2( 1.5, 1.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2( 1.5, -1.5)))*sample_weight;
- if( sampleCount > 4 ) {
- // SampleCount 8
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2(-2.5, -2.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2(-2.5, 2.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2( 2.5, 2.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2( 2.5, -2.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2(-3.5, -3.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2(-3.5, 3.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2( 3.5, 3.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2( 3.5, -3.5)))*sample_weight;
- }
- }
- #if 0
- if(t.w == 0.0){
- discard; // discard freezes NV tegra2 compiler
- }
- #endif
-
- c = t.rgb;
- alpha = gcu_Alpha * t.a;
- } else {
- // pass-1
- vec2 rtex = vec2(abs(gcv_TexCoord.x),abs(gcv_TexCoord.y));
-
- if((gcv_TexCoord.x == 0.0) && (gcv_TexCoord.y == 0.0)) {
- // pass-1: Lines
- c = gcu_ColorStatic.rgb;
- alpha = 1.0;
- } else if ( gcv_TexCoord.x > 0.0 && (rtex.y > 0.0 || rtex.x == 1.0) ) {
- // pass-1: curves
- rtex.y -= 0.1;
-
- if(rtex.y < 0.0 && gcv_TexCoord.y < 0.0) {
- // discard; // freezes NV tegra2 compiler
- c = zero3;
- alpha = 0.0;
- } else {
- rtex.y = max(rtex.y, 0.0);
-
- vec2 dtx = dFdx(rtex);
- vec2 dty = dFdy(rtex);
-
- float w = gcu_Weight;
- float pd = ((2.0 - (2.0*w))*rtex.x*rtex.x) + 2.0*(w-1.0)*rtex.x + 1.0;
- float position = rtex.y - ((w*rtex.x*(1.0 - rtex.x))/pd);
-
- 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.0*rtex.x))/gd), (dty.y - (w*dty.x*(1.0 - 2.0*rtex.x))/gd));
-
- c = gcu_ColorStatic.rgb;
- alpha = clamp(0.5 - ( position/length(f) ) * sign(gcv_TexCoord.y), 0.0, 1.0);
- }
- } else {
- c = zero3;
- alpha = 0.0;
- }
- }
- mgl_FragColor = vec4(c, alpha);
-}
+//Copyright 2010 JogAmp Community. All rights reserved.
+
+//
+// 2-pass shader w/ weight
+//
+
+#if __VERSION__ >= 130
+ #define varying in
+ out vec4 mgl_FragColor;
+ #define texture2D texture
+#else
+ #define mgl_FragColor gl_FragColor
+#endif
+
+#include uniforms.glsl
+#include varyings.glsl
+
+const vec3 zero3 = vec3(0);
+
+void main (void)
+{
+ vec3 color;
+ float alpha;
+
+ // Note: gcu_Alpha is multiplied in pass2!
+
+ if( 0 < gcu_TextureSize.z ) {
+
+// 1st Choice VBAA
+#include curverenderer01-pass2-vbaa_poles_equalweight.glsl
+
+// #include curverenderer01-pass2-vbaa_poles_bilin1.glsl
+// #include curverenderer01-pass2-vbaa_poles_propweight1.glsl
+// #include curverenderer01-pass2-vbaa_wholeedge_propweight1.glsl
+// #include curverenderer01-pass2-vbaa_wholeedge_equalweight.glsl
+// #include curverenderer01-pass2-vbaa_fxaa3.glsl
+
+ } else {
+
+#include curverenderer01-pass1-curve-weight.glsl
+
+ }
+ mgl_FragColor = vec4(color, alpha);
+}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa.fp
index 8237fa55b..89a193501 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa.fp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa.fp
@@ -19,85 +19,26 @@ const vec3 zero3 = vec3(0);
void main (void)
{
- vec3 c;
+ vec3 color;
float alpha;
+ // Note: gcu_Alpha is multiplied in pass2!
+
if( 0 < gcu_TextureSize.z ) {
- // Pass-2: AA on Texture
- // Note: gcv_TexCoord is in center of sample pixels.
- float sampleCount = gcu_TextureSize.z;
- vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size
+// 1st Choice VBAA
+#include curverenderer01-pass2-vbaa_poles_equalweight.glsl
- float sample_weight = 1 / ( 2 * sampleCount );
- // float sample_weight = 1 / ( 2 * sampleCount + 1 );
+// #include curverenderer01-pass2-vbaa_poles_bilin1.glsl
+// #include curverenderer01-pass2-vbaa_poles_propweight1.glsl
+// #include curverenderer01-pass2-vbaa_wholeedge_propweight1.glsl
+// #include curverenderer01-pass2-vbaa_wholeedge_equalweight.glsl
+// #include curverenderer01-pass2-vbaa_fxaa3.glsl
- vec4 t = vec4(0);
- // vec4 t = texture2D(gcu_TextureUnit, gcv_TexCoord)* sample_weight; // center: +1
-
- // SampleCount 2
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2(-0.5, -0.5)))*sample_weight; // NW
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2(-0.5, 0.5)))*sample_weight; // SW
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2( 0.5, 0.5)))*sample_weight; // SE
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2( 0.5, -0.5)))*sample_weight; // NE
- if( sampleCount > 2 ) {
- // SampleCount 4
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2(-1.5, -1.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2(-1.5, 1.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2( 1.5, 1.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2( 1.5, -1.5)))*sample_weight;
- if( sampleCount > 4 ) {
- // SampleCount 8
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2(-2.5, -2.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2(-2.5, 2.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2( 2.5, 2.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2( 2.5, -2.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2(-3.5, -3.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2(-3.5, 3.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2( 3.5, 3.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, gcv_TexCoord + psize*(vec2( 3.5, -3.5)))*sample_weight;
- }
- }
- #if 0
- if(t.w == 0.0){
- discard; // discard freezes NV tegra2 compiler
- }
- #endif
-
- c = t.rgb;
- alpha = gcu_Alpha * t.a;
} else {
- // pass-1
- vec2 rtex = vec2(abs(gcv_TexCoord.x),abs(gcv_TexCoord.y));
-
- if( gcv_TexCoord.x == 0.0 && gcv_TexCoord.y == 0.0 ) {
- // pass-1: Lines
- c = gcu_ColorStatic.rgb;
- alpha = 1.0;
- } else if ( gcv_TexCoord.x > 0.0 && (rtex.y > 0.0 || rtex.x == 1.0) ) {
- // pass-1: curves
- rtex.y -= 0.1;
-
- if(rtex.y < 0.0 && gcv_TexCoord.y < 0.0) {
- // discard; // freezes NV tegra2 compiler
- c = zero3;
- alpha = 0.0;
- } else {
- rtex.y = max(rtex.y, 0.0);
- vec2 dtx = dFdx(rtex);
- vec2 dty = dFdy(rtex);
-
- 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));
+#include curverenderer01-pass1-curve-simple.glsl
- c = gcu_ColorStatic.rgb;
- alpha = clamp(0.5 - ( position/length(f) ) * sign(gcv_TexCoord.y), 0.0, 1.0);
- }
- } else {
- c = zero3;
- alpha = 0.0;
- }
}
- mgl_FragColor = vec4(c, alpha);
+ mgl_FragColor = vec4(color, alpha);
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-lineAA.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-lineAA.glsl
new file mode 100644
index 000000000..16dda5947
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-lineAA.glsl
@@ -0,0 +1,20 @@
+
+ // if( gcv_TexCoord.x == 10.0 && gcv_TexCoord.y == 10.0 ) {
+ if( gcv_TexCoord.z > 0.0 ) {
+ // pass-1: AA Lines
+ #if 1
+ // const float dist = sqrt( gcv_TexCoord.x*gcv_TexCoord.x + gcv_TexCoord.y*gcv_TexCoord.y ); // magnitude
+ const float dist = sqrt( gcv_TexCoord.y*gcv_TexCoord.y ); // magnitude
+ // const float a = 1.0 - smoothstep (gcv_TexCoord.y-gcv_TexCoord.z, gcv_TexCoord.y, dist);
+ const float r = gcv_TexCoord.x/3.0;
+ const float wa = gcv_TexCoord.x+r;
+ const float waHalf = wa/2.0;
+ const float a = 1.0 - smoothstep (waHalf-2.0*r, waHalf, dist);
+ color = vec3(0, 0, 1.0); // gcu_ColorStatic.rgb;
+ alpha = a;
+ #else
+ color = vec3(0, 0, 1.0);
+ alpha = 1.0;
+ #endif
+ } else
+
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-simple.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-simple.glsl
new file mode 100644
index 000000000..df53db686
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-simple.glsl
@@ -0,0 +1,21 @@
+
+ if( gcv_TexCoord.x == 0.0 && gcv_TexCoord.y == 0.0 ) {
+ // pass-1: Lines
+ // color = vec3(0, 1.0, 0);
+ color = gcu_ColorStatic.rgb;
+ alpha = 1.0;
+ } else {
+ // pass-1: curves
+ const vec2 rtex = vec2( abs(gcv_TexCoord.x), abs(gcv_TexCoord.y) - 0.1 );
+
+ const vec2 dtx = dFdx(rtex);
+ const vec2 dty = dFdy(rtex);
+
+ const vec2 f = vec2((dtx.y - dtx.x + 2.0*rtex.x*dtx.x), (dty.y - dty.x + 2.0*rtex.x*dty.x));
+ const float position = rtex.y - (rtex.x * (1.0 - rtex.x));
+
+ // color = vec3(1.0, 0, 0);
+ color = gcu_ColorStatic.rgb;
+ alpha = clamp(0.5 - ( position/length(f) ) * sign(gcv_TexCoord.y), 0.0, 1.0);
+ }
+
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-simple.orig.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-simple.orig.glsl
new file mode 100644
index 000000000..325ddee01
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-simple.orig.glsl
@@ -0,0 +1,32 @@
+
+ vec2 rtex = vec2( abs(gcv_TexCoord.x), abs(gcv_TexCoord.y) );
+
+ if( gcv_TexCoord.x == 0.0 && gcv_TexCoord.y == 0.0 ) {
+ // pass-1: Lines
+ color = gcu_ColorStatic.rgb;
+ alpha = 1.0;
+ } else if ( gcv_TexCoord.x > 0.0 && ( rtex.y > 0.0 || rtex.x == 1.0 ) ) {
+ // pass-1: curves
+ rtex.y -= 0.1;
+
+ if(rtex.y < 0.0 && gcv_TexCoord.y < 0.0) {
+ // discard; // freezes NV tegra2 compiler
+ color = zero3;
+ alpha = 0.0;
+ } else {
+ rtex.y = max(rtex.y, 0.0); // always >= 0
+
+ const vec2 dtx = dFdx(rtex);
+ const vec2 dty = dFdy(rtex);
+
+ const vec2 f = vec2((dtx.y - dtx.x + 2.0*rtex.x*dtx.x), (dty.y - dty.x + 2.0*rtex.x*dty.x));
+ const float position = rtex.y - (rtex.x * (1.0 - rtex.x));
+
+ color = gcu_ColorStatic.rgb;
+ alpha = clamp(0.5 - ( position/length(f) ) * sign(gcv_TexCoord.y), 0.0, 1.0);
+ }
+ } else {
+ color = zero3;
+ alpha = 0.0;
+ }
+
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-weight.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-weight.glsl
new file mode 100644
index 000000000..a489949b4
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-weight.glsl
@@ -0,0 +1,25 @@
+
+ if( gcv_TexCoord.x == 0.0 && gcv_TexCoord.y == 0.0 ) {
+ // pass-1: Lines
+ color = gcu_ColorStatic.rgb;
+ alpha = 1.0;
+ } else {
+ // pass-1: curves
+ const vec2 rtex = vec2( abs(gcv_TexCoord.x), abs(gcv_TexCoord.y) - 0.1 );
+
+ const vec2 dtx = dFdx(rtex);
+ const vec2 dty = dFdy(rtex);
+
+ const float w = gcu_Weight;
+ const float pd = ((2.0 - (2.0*w))*rtex.x*rtex.x) + 2.0*(w-1.0)*rtex.x + 1.0;
+ const float position = rtex.y - ((w*rtex.x*(1.0 - rtex.x))/pd);
+
+ const float aph = 2.0 - 2.0*w;
+
+ const float gd = (aph*rtex.x*rtex.x + 2.0*rtex.x + 1.0)*(aph*rtex.x*rtex.x + 2.0*rtex.x + 1.0);
+ const 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));
+
+ color = gcu_ColorStatic.rgb;
+ alpha = clamp(0.5 - ( position/length(f) ) * sign(gcv_TexCoord.y), 0.0, 1.0);
+ }
+
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_fxaa3.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_fxaa3.glsl
new file mode 100644
index 000000000..d27d9df12
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_fxaa3.glsl
@@ -0,0 +1,56 @@
+
+ // Pass-2: AA on Texture
+ // Note: gcv_TexCoord is in center of sample pixels.
+
+ if( gcu_TextureSize.z < 4 ) {
+ // FXAA-2
+ const float FXAA_REDUCE_MIN = (1.0/128.0);
+ const float FXAA_REDUCE_MUL = (1.0/8.0);
+ const float FXAA_SPAN_MAX = 8.0;
+
+ const float sampleCount = gcu_TextureSize.z;
+
+ const vec2 texCoord = gcv_TexCoord.st;
+ const float poff = 1.0;
+ const vec2 psize = 1.0 / texCoord; // pixel size
+
+ const vec3 rgbNW = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-poff, -poff))).rgb;
+ const vec3 rgbSW = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-poff, poff))).rgb;
+ const vec3 rgbSE = texture2D(gcu_TextureUnit, texCoord + psize*(vec2( poff, poff))).rgb;
+ const vec3 rgbNE = texture2D(gcu_TextureUnit, texCoord + psize*(vec2( poff, -poff))).rgb;
+ const vec4 rgbM = texture2D(gcu_TextureUnit, texCoord);
+
+ const vec3 luma = vec3(0.299, 0.587, 0.114);
+ const float lumaNW = dot(rgbNW, luma);
+ const float lumaNE = dot(rgbNE, luma);
+ const float lumaSW = dot(rgbSW, luma);
+ const float lumaSE = dot(rgbSE, luma);
+ const float lumaM = dot(rgbM.rgb, luma);
+ const float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
+ const float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
+ vec2 dir;
+ dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
+ dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
+ const float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL),FXAA_REDUCE_MIN);
+ const float rcpDirMin = 1.0/(min(abs(dir.x), abs(dir.y)) + dirReduce);
+ dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),
+ max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),dir * rcpDirMin) ) * psize;
+
+
+ const vec3 rgbA = 0.5 * ( texture2D(gcu_TextureUnit, texCoord + dir * (1.0/3.0 - 0.5)).rgb +
+ texture2D(gcu_TextureUnit, texCoord + dir * (2.0/3.0 - 0.5)).rgb );
+ const vec3 rgbB = rgbA * 0.5 + 0.25 * ( texture2D(gcu_TextureUnit, texCoord + (dir * - 0.5)).rgb +
+ texture2D(gcu_TextureUnit, texCoord + (dir * 0.5)).rgb );
+ const float lumaB = dot(rgbB, luma);
+ if((lumaB < lumaMin) || (lumaB > lumaMax)) {
+ color = rgbA;
+ } else {
+ color = rgbB;
+ }
+ alpha = gcu_Alpha * rgbM.a; // mix(0.0, gcu_Alpha, rgbM.a); // t.a one of [ 0.0, 1.0 ]
+ } else {
+
+#include curverenderer01-pass2-vbaa_poles_equalweight.glsl
+
+ }
+
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_bilin1.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_bilin1.glsl
new file mode 100644
index 000000000..f582ee8a2
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_bilin1.glsl
@@ -0,0 +1,92 @@
+ // Pass-2: AA on Texture
+ // Note: gcv_TexCoord is in center of sample pixels.
+
+ const vec2 texCoord = gcv_TexCoord.st;
+
+ const float sampleCount = gcu_TextureSize.z;
+ const vec2 tsize = gcu_TextureSize.xy; // tex size
+ const vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size
+
+ // mix(x,y,a): x*(1-a) + y*a
+ //
+ // bilinear filtering includes 2 mix:
+ //
+ // pix1 = tex[x0][y0] * ( 1 - u_ratio ) + tex[x1][y0] * u_ratio
+ // pix2 = tex[x0][y1] * ( 1 - u_ratio ) + tex[x1][y1] * u_ratio
+ // fin = pix1 * ( 1 - v_ratio ) + pix2 * v_ratio
+ //
+ // so we can use the build in mix function for these 2 computations ;-)
+ //
+ const vec2 uv_ratio = fract(texCoord*tsize); // texCoord*tsize - floor(texCoord*tsize);
+
+ // Just poles (NW, SW, ..)
+ const float pixelCount = 2 * sampleCount;
+
+ // sampleCount [0, 1, 3, 5, 7] are undefined!
+ const float layerCount = ( sampleCount / 2.0 );
+
+ // sum of all integer [layerCount .. 1] -> Gauss
+ const float denom = ( layerCount / 2.0 ) * ( layerCount + 1.0 );
+
+ vec4 t, p1, p2, p3, p4;
+
+ // Layer-1: SampleCount 2 -> 4x
+ p1 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -0.5))); // NW
+ p2 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 0.5))); // SW
+ p3 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 0.5))); // SE
+ p4 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -0.5))); // NE
+
+ p1 = mix( p1, p4, uv_ratio.x);
+ p2 = mix( p2, p3, uv_ratio.x);
+ t = mix ( p1, p2, uv_ratio.y );
+
+ t *= (layerCount - 0.0) / ( denom ); // weight layer 1
+
+ if( sampleCount > 2 ) {
+ // Layer-2: SampleCount 4 -> +4x = 8p
+ p1 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -1.5))); // NW
+ p2 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 1.5))); // SW
+ p3 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 1.5))); // SE
+ p4 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -1.5))); // NE
+
+ p1 = mix( p1, p4, uv_ratio.x);
+ p2 = mix( p2, p3, uv_ratio.x);
+ p3 = mix ( p1, p2, uv_ratio.y );
+ t += p3 * (layerCount - 1) / ( denom ); // weight layer 2
+
+ if( sampleCount > 4 ) {
+ // Layer-3: SampleCount 6 -> +4 = 12p
+ p1 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -2.5))); // NW
+ p2 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 2.5))); // SW
+ p3 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 2.5))); // SE
+ p4 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -2.5))); // NE
+
+ p1 = mix( p1, p4, uv_ratio.x);
+ p2 = mix( p2, p3, uv_ratio.x);
+ p3 = mix ( p1, p2, uv_ratio.y );
+ t += p3 * (layerCount - 2) / ( denom ); // weight layer 3
+
+ if( sampleCount > 6 ) {
+ // Layer-4: SampleCount 8 -> +4 = 16p
+ p1 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -3.5))); // NW
+ p2 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 3.5))); // SW
+ p3 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 3.5))); // SE
+ p4 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -3.5))); // NE
+
+ p1 = mix( p1, p4, uv_ratio.x);
+ p2 = mix( p2, p3, uv_ratio.x);
+ p3 = mix ( p1, p2, uv_ratio.y );
+
+ t += p3 * (layerCount - 3) / ( denom ); // weight layer 4
+ }
+ }
+ }
+
+ #if 0
+ if(t.w == 0.0){
+ discard; // discard freezes NV tegra2 compiler
+ }
+ #endif
+
+ color = t.rgb;
+ alpha = gcu_Alpha * t.a;
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_equalweight.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_equalweight.glsl
new file mode 100644
index 000000000..d1efb1206
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_equalweight.glsl
@@ -0,0 +1,50 @@
+
+ // Pass-2: AA on Texture
+ // Note: gcv_TexCoord is in center of sample pixels.
+
+ const float sampleCount = gcu_TextureSize.z;
+ const vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size
+
+ // Just poles (NW, SW, ..)
+ const float sample_weight = 1 / ( 2 * sampleCount );
+
+ const vec2 texCoord = gcv_TexCoord.st;
+
+ vec4 t = vec4(0);
+
+ // SampleCount 2 -> 4x
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -0.5)))*sample_weight; // NW
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 0.5)))*sample_weight; // SW
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 0.5)))*sample_weight; // SE
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -0.5)))*sample_weight; // NE
+ if( sampleCount > 2 ) {
+ // SampleCount 4 -> +4 = 8p
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -1.5)))*sample_weight; // NW
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 1.5)))*sample_weight; // SW
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 1.5)))*sample_weight; // SE
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -1.5)))*sample_weight; // NE
+
+ if( sampleCount > 4 ) {
+ // SampleCount 6 -> +4 = 12p
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -2.5)))*sample_weight; // NW
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 2.5)))*sample_weight; // SW
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 2.5)))*sample_weight; // SE
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -2.5)))*sample_weight; // NE
+ if( sampleCount > 6 ) {
+ // SampleCount 8 -> +4 = 16p
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -3.5)))*sample_weight; // NW
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 3.5)))*sample_weight; // SW
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 3.5)))*sample_weight; // SE
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -3.5)))*sample_weight; // NE
+ }
+ }
+ }
+ #if 0
+ if(t.w == 0.0){
+ discard; // discard freezes NV tegra2 compiler
+ }
+ #endif
+
+ color = t.rgb;
+ alpha = gcu_Alpha * t.a;
+
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_propweight1.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_propweight1.glsl
new file mode 100644
index 000000000..3459e3da6
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_propweight1.glsl
@@ -0,0 +1,66 @@
+ // Pass-2: AA on Texture
+ // Note: gcv_TexCoord is in center of sample pixels.
+
+ const float sampleCount = gcu_TextureSize.z;
+ const vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size
+
+ // Just poles (NW, SW, ..)
+ const float pixelCount = 2 * sampleCount;
+
+ // sampleCount [0, 1, 3, 5, 7] are undefined!
+ const float layerCount = ( sampleCount / 2.0 );
+
+ // sum of all integer [layerCount .. 1] -> Gauss
+ const float denom = ( layerCount / 2.0 ) * ( layerCount + 1.0 );
+
+ const vec2 texCoord = gcv_TexCoord.st;
+
+ vec4 t = vec4(0);
+
+ // Layer-1: SampleCount 2 -> 4x
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -0.5))); // NW
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 0.5))); // SW
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 0.5))); // SE
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -0.5))); // NE
+
+ t *= (layerCount - 0.0) / ( denom * 4.0 ); // weight layer 1
+
+ if( sampleCount > 2 ) {
+ // Layer-2: SampleCount 4 -> +4x = 8p
+ vec4 tn = vec4(0);
+ tn = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -1.5))); // NW
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 1.5))); // SW
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 1.5))); // SE
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -1.5))); // NE
+
+ t += tn * (layerCount - 1) / ( denom * 4.0 ); // weight layer 2
+
+ if( sampleCount > 4 ) {
+ // Layer-3: SampleCount 6 -> +4 = 12p
+ tn = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -2.5))); // NW
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 2.5))); // SW
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 2.5))); // SE
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -2.5))); // NE
+
+ t += tn * (layerCount - 2) / ( denom * 4.0 ); // weight layer 3
+
+ if( sampleCount > 6 ) {
+ // Layer-4: SampleCount 8 -> +4 = 16p
+ tn = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -3.5))); // NW
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 3.5))); // SW
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 3.5))); // SE
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -3.5))); // NE
+
+ t += tn * (layerCount - 3) / ( denom * 4.0 ); // weight layer 4
+ }
+ }
+ }
+
+ #if 0
+ if(t.w == 0.0){
+ discard; // discard freezes NV tegra2 compiler
+ }
+ #endif
+
+ color = t.rgb;
+ alpha = gcu_Alpha * t.a;
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_wholeedge_equalweight.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_wholeedge_equalweight.glsl
new file mode 100644
index 000000000..3c787b46e
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_wholeedge_equalweight.glsl
@@ -0,0 +1,98 @@
+ // Pass-2: AA on Texture
+ // Note: gcv_TexCoord is in center of sample pixels.
+
+ const float sampleCount = gcu_TextureSize.z;
+ const vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size
+
+ // Not only the poles (NW, SW, ..) but the whole edge!
+ const float sample_weight = 1 / ( sampleCount * sampleCount );
+
+ // const vec4 tex_weights = vec4(0.075, 0.06, 0.045, 0.025);
+
+ const vec2 texCoord = gcv_TexCoord.st;
+
+ vec4 t = vec4(0);
+
+ // SampleCount 2 -> 4x
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -0.5)))*sample_weight; // NW
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 0.5)))*sample_weight; // SW
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 0.5)))*sample_weight; // SE
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -0.5)))*sample_weight; // NE
+ if( sampleCount > 2 ) {
+ // SampleCount 4 -> +12x = 16p
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -1.5)))*sample_weight; // NW -> SW Edge
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -0.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 0.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 1.5)))*sample_weight; // SW -> SE Edge
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 1.5)))*sample_weight; //
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 1.5)))*sample_weight; //
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 1.5)))*sample_weight; // SE -> NE Edge
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 0.5)))*sample_weight; //
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -0.5)))*sample_weight; //
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -1.5)))*sample_weight; // NE -> NW Edge
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -1.5)))*sample_weight; //
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -1.5)))*sample_weight; // NW - 1 (closed)
+
+ if( sampleCount > 4 ) {
+ // SampleCount 6 -> +20x = 36p
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -2.5)))*sample_weight; // NW -> SW Edge
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -1.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -0.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 0.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 1.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 2.5)))*sample_weight; // SW -> SE Edge
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 2.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 2.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 2.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 2.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 2.5)))*sample_weight; // SE -> NE Edge
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 1.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 0.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -0.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -1.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -2.5)))*sample_weight; // NE -> NW Edge
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -2.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -2.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -2.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -2.5)))*sample_weight; // NW - 1 (closed)
+ if( sampleCount > 6 ) {
+ // SampleCount 8 -> +28x = 64p
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -3.5)))*sample_weight; // NW -> SW Edge
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -2.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -1.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -0.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 0.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 1.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 2.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 3.5)))*sample_weight; // SW -> SE Edge
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 3.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 3.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 3.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 3.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 3.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 3.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 3.5)))*sample_weight; // SE -> NE Edge
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 2.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 1.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 0.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -0.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -1.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -2.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -3.5)))*sample_weight; // NE -> NW Edge
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -3.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -3.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -3.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -3.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -3.5)))*sample_weight;
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -3.5)))*sample_weight; // NW - 1 (closed)
+ }
+ }
+ }
+ #if 0
+ if(t.w == 0.0){
+ discard; // discard freezes NV tegra2 compiler
+ }
+ #endif
+
+ color = t.rgb;
+ alpha = gcu_Alpha * t.a;
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_wholeedge_propweight1.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_wholeedge_propweight1.glsl
new file mode 100644
index 000000000..76227eba3
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_wholeedge_propweight1.glsl
@@ -0,0 +1,114 @@
+ // Pass-2: AA on Texture
+ // Note: gcv_TexCoord is in center of sample pixels.
+
+ const float sampleCount = gcu_TextureSize.z;
+ const vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size
+
+ // Not only the poles (NW, SW, ..) but the whole edge!
+ const float pixelCount = sampleCount * sampleCount;
+
+ // sampleCount [0, 1, 3, 5, 7] are undefined!
+ const float layerCount = ( sampleCount / 2.0 );
+
+ // sum of all integer [layerCount .. 1] -> Gauss
+ const float denom = ( layerCount / 2.0 ) * ( layerCount + 1.0 );
+
+ const vec2 texCoord = gcv_TexCoord.st;
+
+ vec4 t = vec4(0);
+
+ // Layer-1: SampleCount 2 -> 4x
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -0.5))); // NW
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 0.5))); // SW
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 0.5))); // SE
+ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -0.5))); // NE
+
+ t *= (layerCount - 0.0) / ( denom * 4.0 ); // weight layer 1
+
+ if( sampleCount > 2 ) {
+ // Layer-2: SampleCount 4 -> +12x = 16p
+ vec4 tn = vec4(0);
+ tn = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -1.5))); // NW -> SW Edge
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -0.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 0.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 1.5))); // SW -> SE Edge
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 1.5))); //
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 1.5))); //
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 1.5))); // SE -> NE Edge
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 0.5))); //
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -0.5))); //
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -1.5))); // NE -> NW Edge
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -1.5))); //
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -1.5))); // NW - 1 (closed)
+
+ t += tn * (layerCount - 1) / ( denom * 12.0 ); // weight layer 2
+
+ if( sampleCount > 4 ) {
+ // Layer-3: SampleCount 6 -> +20x = 36p
+ tn = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -2.5))); // NW -> SW Edge
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -1.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -0.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 0.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 1.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 2.5))); // SW -> SE Edge
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 2.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 2.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 2.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 2.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 2.5))); // SE -> NE Edge
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 1.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 0.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -0.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -1.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -2.5))); // NE -> NW Edge
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -2.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -2.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -2.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -2.5))); // NW - 1 (closed)
+
+ t += tn * (layerCount - 2) / ( denom * 20.0 ); // weight layer 3
+
+ if( sampleCount > 6 ) {
+ // Layer-4: SampleCount 8 -> +28x = 64p
+ tn = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -3.5))); // NW -> SW Edge
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -2.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -1.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -0.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 0.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 1.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 2.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 3.5))); // SW -> SE Edge
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 3.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 3.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 3.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 3.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 3.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 3.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 3.5))); // SE -> NE Edge
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 2.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 1.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 0.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -0.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -1.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -2.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -3.5))); // NE -> NW Edge
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -3.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -3.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -3.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -3.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -3.5)));
+ tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -3.5))); // NW - 1 (closed)
+
+ t += tn * (layerCount - 3) / ( denom * 28.0 ); // weight layer 4
+ }
+ }
+ }
+
+ #if 0
+ if(t.w == 0.0){
+ discard; // discard freezes NV tegra2 compiler
+ }
+ #endif
+
+ color = t.rgb;
+ alpha = gcu_Alpha * t.a;
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.vp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.vp
index 4b5c8b1e2..b3c9ebd35 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.vp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.vp
@@ -11,7 +11,13 @@
void main(void)
{
- // gl_Position = gcu_PMVMatrix[0] * gcu_PMVMatrix[1] * vec4(gca_Vertices, 1);
- gl_Position = gcu_PMVMatrix[0] * gcu_PMVMatrix[1] * gca_Vertices;
- gcv_TexCoord = gca_TexCoords;
+ // gl_Position = gcu_PMVMatrix[0] * gcu_PMVMatrix[1] * vec4(gca_Vertices, 1);
+ gl_Position = gcu_PMVMatrix[0] * gcu_PMVMatrix[1] * gca_Vertices;
+ if( gcv_TexCoord.x <= -10.0 ) {
+ // const vec4 tc = gcu_PMVMatrix[0] * gcu_PMVMatrix[1] * vec4(gca_TexCoords.xy, gca_Vertices.z, 1);
+ // gcv_TexCoord = vec3(tc.xy, gca_TexCoords.z);
+ gcv_TexCoord = gca_TexCoords;
+ } else {
+ gcv_TexCoord = gca_TexCoords;
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl
index 7a9bc5a07..17f118bc8 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl
@@ -3,7 +3,7 @@
#define varyings_glsl
//varying vec4 gcv_FrontColor;
-varying vec2 gcv_TexCoord;
+varying vec3 gcv_TexCoord;
#endif // varyings_glsl