summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp/graph')
-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
-rw-r--r--src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java75
-rw-r--r--src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2DExpAddOn.java340
-rw-r--r--src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java4
-rw-r--r--src/jogl/classes/jogamp/graph/curve/tess/Loop.java38
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java3
28 files changed, 1327 insertions, 522 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
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java
index 35263407d..ad01c24fa 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java
@@ -39,14 +39,18 @@ import com.jogamp.opengl.math.VectorUtil;
import jogamp.opengl.Debug;
-/** Constrained Delaunay Triangulation
+/**
+ * Constrained Delaunay Triangulation
* implementation of a list of Outlines that define a set of
* Closed Regions with optional n holes.
- *
*/
public class CDTriangulator2D implements Triangulator {
- protected static final boolean DEBUG = Debug.debug("Triangulation");
+ protected static final boolean DEBUG = Debug.debug("graph.curve.Triangulation");
+
+ private static final boolean TEST_LINE_AA = Debug.debug("graph.curve.triangulation.LINE_AA");
+ private static final boolean TEST_MARK_LINE = Debug.debug("graph.curve.triangulation.MARK_AA");
+ private static final boolean TEST_ENABLED = TEST_LINE_AA || TEST_MARK_LINE;
private final ArrayList<Loop> loops = new ArrayList<Loop>();
@@ -89,7 +93,8 @@ public class CDTriangulator2D implements Triangulator {
@Override
public final void generate(List<Triangle> sink) {
- for(int i=0;i<loops.size();i++) {
+ final int loopsSize = loops.size();
+ for(int i=0;i<loopsSize;i++) {
final Loop loop = loops.get(i);
int numTries = 0;
int size = loop.computeLoopSize();
@@ -109,12 +114,12 @@ public class CDTriangulator2D implements Triangulator {
tri.setId(maxTriID++);
sink.add(tri);
if(DEBUG){
- System.err.println(tri);
+ System.err.println("CDTri.gen["+i+"].0: "+tri);
}
}
if(numTries > size*2){
if(DEBUG){
- System.err.println("Triangulation not complete!");
+ System.err.println("CDTri.gen["+i+"].X: Triangulation not complete!");
}
break;
}
@@ -122,6 +127,26 @@ public class CDTriangulator2D implements Triangulator {
final Triangle tri = loop.cut(true);
if(tri != null) {
sink.add(tri);
+ if(DEBUG){
+ System.err.println("CDTri.gen["+i+"].1: "+tri);
+ }
+ }
+ }
+ if( TEST_ENABLED ) {
+ final float[] tempV2 = new float[2];
+ final CDTriangulator2DExpAddOn addOn = new CDTriangulator2DExpAddOn();
+ final int sinkSize = sink.size();
+ if( TEST_MARK_LINE ) {
+ for(int i=0; i<sinkSize; i++) {
+ final Triangle t0 = sink.get(i);
+ addOn.markLineInTriangle(t0, tempV2);
+ }
+ } else if ( TEST_LINE_AA ){
+ for(int i=0; i<sinkSize-1; i+=2) {
+ final Triangle t0 = sink.get(i);
+ final Triangle t1 = sink.get(i+1);
+ /* final float[] rect = */ addOn.processLineAA(i, t0, t1, tempV2);
+ }
}
}
}
@@ -131,15 +156,15 @@ public class CDTriangulator2D implements Triangulator {
final ArrayList<GraphVertex> outVertices = outline.getGraphPoint();
final int size = outVertices.size();
for(int i=0; i < size; i++) {
- final GraphVertex currentVertex = outVertices.get(i);
- final GraphVertex gv0 = outVertices.get((i+size-1)%size);
- final GraphVertex gv2 = outVertices.get((i+1)%size);
- final GraphVertex gv1 = currentVertex;
+ final GraphVertex gv1 = outVertices.get(i); // currentVertex
+ final GraphVertex gv0 = outVertices.get((i+size-1)%size); // -1
+ final GraphVertex gv2 = outVertices.get((i+1)%size); // +1
- if( !currentVertex.getPoint().isOnCurve() ) {
+ if( !gv1.getPoint().isOnCurve() ) {
final Vertex v0 = gv0.getPoint().clone();
final Vertex v2 = gv2.getPoint().clone();
final Vertex v1 = gv1.getPoint().clone();
+ final boolean[] boundaryVertices = { true, true, true };
gv0.setBoundaryContained(true);
gv1.setBoundaryContained(true);
@@ -149,10 +174,10 @@ public class CDTriangulator2D implements Triangulator {
final boolean holeLike;
if(VectorUtil.ccw(v0,v1,v2)) {
holeLike = false;
- t = new Triangle(v0, v1, v2);
+ t = new Triangle(v0, v1, v2, boundaryVertices);
} else {
holeLike = true;
- t = new Triangle(v2, v1, v0);
+ t = new Triangle(v2, v1, v0, boundaryVertices);
}
t.setId(maxTriID++);
sink.add(t);
@@ -160,20 +185,26 @@ public class CDTriangulator2D implements Triangulator {
System.err.println(t);
}
if( hole || holeLike ) {
- v0.setTexCoord(0, -0.1f);
- v2.setTexCoord(1, -0.1f);
- v1.setTexCoord(0.5f, -1*sharpness-0.1f);
- innerOutline.addVertex(currentVertex);
+ v0.setTexCoord(0.0f, -0.1f, 0f);
+ v2.setTexCoord(1.0f, -0.1f, 0f);
+ v1.setTexCoord(0.5f, -sharpness-0.1f, 0f);
+ innerOutline.addVertex(gv1);
} else {
- v0.setTexCoord(0, 0.1f);
- v2.setTexCoord(1, 0.1f);
- v1.setTexCoord(0.5f, sharpness+0.1f);
+ v0.setTexCoord(0.0f, 0.1f, 0f);
+ v2.setTexCoord(1.0f, 0.1f, 0f);
+ v1.setTexCoord(0.5f, sharpness+0.1f, 0f);
+ }
+ if(DEBUG) {
+ System.err.println("CDTri.ebt["+i+"].0: hole "+(hole || holeLike)+" "+gv1+", "+t);
}
} else {
if( !gv2.getPoint().isOnCurve() || !gv0.getPoint().isOnCurve() ) {
- currentVertex.setBoundaryContained(true);
+ gv1.setBoundaryContained(true);
+ }
+ innerOutline.addVertex(gv1);
+ if(DEBUG) {
+ System.err.println("CDTri.ebt["+i+"].1: "+gv1);
}
- innerOutline.addVertex(currentVertex);
}
}
return innerOutline;
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2DExpAddOn.java b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2DExpAddOn.java
new file mode 100644
index 000000000..2ada436f8
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2DExpAddOn.java
@@ -0,0 +1,340 @@
+/**
+ * Copyright 2014 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package jogamp.graph.curve.tess;
+
+import com.jogamp.graph.geom.Triangle;
+import com.jogamp.graph.geom.Vertex;
+import com.jogamp.opengl.math.FloatUtil;
+import com.jogamp.opengl.math.VectorUtil;
+
+/**
+ * Experimental Add-On ..
+ *
+ * Disabled by default
+ */
+public class CDTriangulator2DExpAddOn {
+
+ private final float[] tempV3a = new float[3];
+ private final float[] tempV3b = new float[3];
+
+ protected final void markLineInTriangle(final Triangle tri1, final float[] tempV2) {
+ if( !tri1.isOnCurve() || !tri1.isLine() ) {
+ return;
+ }
+
+ final boolean[] boundVs = tri1.getVerticesBoundary();
+ final Vertex[] triVs = tri1.getVertices();
+ final Vertex v0 = triVs[0];
+ final Vertex v1 = triVs[1];
+ final Vertex v2 = triVs[2];
+
+ int lineSegCount = 0;
+ final boolean v0IsLS, v1IsLS, v2IsLS;
+ if( v0.isOnCurve() && VectorUtil.isVec2Zero(v0.getTexCoord(), 0) && !boundVs[0] ) {
+ v0IsLS = true;
+ lineSegCount++;
+ } else {
+ v0IsLS = false;
+ }
+ if( v1.isOnCurve() && VectorUtil.isVec2Zero(v1.getTexCoord(), 0) && !boundVs[1] ) {
+ v1IsLS = true;
+ lineSegCount++;
+ } else {
+ v1IsLS = false;
+ }
+ if( v2.isOnCurve() && VectorUtil.isVec2Zero(v2.getTexCoord(), 0) && !boundVs[2] ) {
+ v2IsLS = true;
+ lineSegCount++;
+ } else {
+ v2IsLS = false;
+ }
+ if( 2 > lineSegCount ) {
+ return;
+ } else {
+ if(CDTriangulator2D.DEBUG) {
+ System.err.println("CDTri.markLine.1: "+tri1);
+ System.err.println("CDTri.markLine.1: count "+lineSegCount+", v0IsLS "+v0IsLS+", v1IsLS "+v1IsLS+", v2IsLS "+v2IsLS);
+ }
+ final float texZTag = 2f;
+ if( true ) {
+ if( v0IsLS ) {
+ v0.setTexCoord(0f, 0f, texZTag);
+ }
+ if( v1IsLS ) {
+ v1.setTexCoord(0f, 0f, texZTag);
+ }
+ if( v2IsLS ) {
+ v2.setTexCoord(0f, 0f, texZTag);
+ }
+ } else {
+ if( v0IsLS ) {
+ final Vertex v = v0.clone();
+ v.setTexCoord(0f, 0f, texZTag);
+ triVs[0] = v;
+ }
+ if( v1IsLS ) {
+ final Vertex v = v1.clone();
+ v.setTexCoord(0f, 0f, texZTag);
+ triVs[1] = v;
+ }
+ if( v2IsLS ) {
+ final Vertex v = v2.clone();
+ v.setTexCoord(0f, 0f, texZTag);
+ triVs[2] = v;
+ }
+ }
+ if ( false ) {
+ final Vertex vL1, vL2, vL3, vO;
+ if( 3 == lineSegCount ) {
+ vL1 = v0; vL2=v1; vL3=v2; vO=null;
+ } else if( v0IsLS && v1IsLS ) {
+ vL1 = v0; vL2=v1; vL3=null; vO=v2;
+ } else if( v0IsLS && v2IsLS ) {
+ vL1 = v0; vL2=v2; vL3=null; vO=v1;
+ } else if( v1IsLS && v2IsLS ) {
+ vL1 = v1; vL2=v2; vL3=null; vO=v0;
+ } else {
+ return; // unreachable
+ }
+ if( null != vL1 ) {
+ vL1.setTexCoord(texZTag, 0f, 0f);
+ }
+ if( null != vL2 ) {
+ vL2.setTexCoord(texZTag, 0f, 0f);
+ }
+ if( null != vL3 ) {
+ vL3.setTexCoord(texZTag, 0f, 0f);
+ }
+ }
+ }
+ }
+
+ /**
+ * If this and the other triangle compose a rectangle return the
+ * given <code>tempV2</code> array w/ shortest side first.
+ * Otherwise return null;
+ * <p>
+ * Experimental CODE, enabled only if {@link #TEST_LINE_AA} is set .. WIP
+ * </p>
+ * <p>
+ One test uses method: ROESSLER-2012-OGLES <http://www.cg.tuwien.ac.at/research/publications/2012/ROESSLER-2012-OGLES/>
+ * </p>
+ * <p>
+ * However, we would need to tesselate all lines appropriately,
+ * i.e. create 2 triangles sharing the middle actual line using thickness+radius.
+ *
+ * This test simply used our default font w/ a line thickness of 2 pixels,
+ * which produced mentioned rectangles.
+ * This is of course not the case for arbitrary Outline shapes.
+ * </p>
+ * @param tri2
+ * @param checkThisOnCurve
+ * @param tempV2 temp float[2] storage
+ */
+ protected final float[] processLineAA(final int i, final Triangle tri1, final Triangle tri2, final float[] tempV2) {
+ if(CDTriangulator2D.DEBUG){
+ System.err.println("CDTri.genP2["+i+"].1: ? t1 "+tri1);
+ System.err.println("CDTri.genP2["+i+"].1: ? t2 "+tri2);
+ }
+ final float[] rect = processLineAAImpl(tri1, tri2, tempV2);
+ if(CDTriangulator2D.DEBUG){
+ if( null != rect ) {
+ System.err.println("CDTri.genP2["+i+"].1: RECT ["+rect[0]+", "+rect[1]+"]");
+ System.err.println("CDTri.genP2["+i+"].1: RECT t1 "+tri1);
+ System.err.println("CDTri.genP2["+i+"].1: RECT t2 "+tri2);
+ } else {
+ System.err.println("CDTri.genP2["+i+"].1: RECT NOPE, t1 "+tri1);
+ System.err.println("CDTri.genP2["+i+"].1: RECT NOPE, t2 "+tri2);
+ }
+ }
+ return rect;
+ }
+ private final float[] processLineAAImpl(final Triangle tri1, final Triangle tri2, final float[] tempV2) {
+ if( !tri1.isOnCurve() || !tri2.isOnCurve() || !tri1.isLine() || !tri2.isLine() ) {
+ return null;
+ }
+ final float[] rect;
+ int eqCount = 0;
+ final int[] commonIdxA = { -1, -1 };
+ final int[] commonIdxB = { -1, -1 };
+ final Vertex[] verts1 = tri1.getVertices();
+ final Vertex[] verts2 = tri2.getVertices();
+ float[] coord = verts1[0].getCoord();
+ if( VectorUtil.isVec3Equal(coord, 0, verts2[0].getCoord(), 0, FloatUtil.EPSILON) ) {
+ commonIdxA[eqCount] = 0;
+ commonIdxB[eqCount] = 0;
+ eqCount++;
+ } else if( VectorUtil.isVec3Equal(coord, 0, verts2[1].getCoord(), 0, FloatUtil.EPSILON) ) {
+ commonIdxA[eqCount] = 0;
+ commonIdxB[eqCount] = 1;
+ eqCount++;
+ } else if( VectorUtil.isVec3Equal(coord, 0, verts2[2].getCoord(), 0, FloatUtil.EPSILON) ) {
+ commonIdxA[eqCount] = 0;
+ commonIdxB[eqCount] = 2;
+ eqCount++;
+ }
+ coord = verts1[1].getCoord();
+ if( VectorUtil.isVec3Equal(coord, 0, verts2[0].getCoord(), 0, FloatUtil.EPSILON) ) {
+ commonIdxA[eqCount] = 1;
+ commonIdxB[eqCount] = 0;
+ eqCount++;
+ } else if( VectorUtil.isVec3Equal(coord, 0, verts2[1].getCoord(), 0, FloatUtil.EPSILON) ) {
+ commonIdxA[eqCount] = 1;
+ commonIdxB[eqCount] = 1;
+ eqCount++;
+ } else if( VectorUtil.isVec3Equal(coord, 0, verts2[2].getCoord(), 0, FloatUtil.EPSILON) ) {
+ commonIdxA[eqCount] = 1;
+ commonIdxB[eqCount] = 2;
+ eqCount++;
+ }
+ final int otherIdxA;
+ if( 2 == eqCount ) {
+ otherIdxA = 3 - ( commonIdxA[0] + commonIdxA[1] );
+ } else {
+ coord = verts1[2].getCoord();
+ if( VectorUtil.isVec3Equal(coord, 0, verts2[0].getCoord(), 0, FloatUtil.EPSILON) ) {
+ commonIdxA[eqCount] = 2;
+ commonIdxB[eqCount] = 0;
+ eqCount++;
+ } else if( VectorUtil.isVec3Equal(coord, 0, verts2[1].getCoord(), 0, FloatUtil.EPSILON) ) {
+ commonIdxA[eqCount] = 2;
+ commonIdxB[eqCount] = 1;
+ eqCount++;
+ } else if( VectorUtil.isVec3Equal(coord, 0, verts2[2].getCoord(), 0, FloatUtil.EPSILON) ) {
+ commonIdxA[eqCount] = 2;
+ commonIdxB[eqCount] = 2;
+ eqCount++;
+ }
+ if( 2 == eqCount ) {
+ otherIdxA = 3 - ( commonIdxA[0] + commonIdxA[1] );
+ } else {
+ otherIdxA = -1;
+ }
+ }
+ if( 0 <= otherIdxA && commonIdxB[0] != commonIdxB[1] ) {
+ final int otherIdxB = 3 - ( commonIdxB[0] + commonIdxB[1] );
+ // Reference must be equal, i.e. sharing the actual same vertices!
+ if( verts1[commonIdxA[0]] != verts2[commonIdxB[0]] || verts1[commonIdxA[1]] != verts2[commonIdxB[1]] ) {
+ throw new InternalError("XXX: diff shared verts"); // FIXME remove when clear
+ }
+ final Vertex vC0A, vC1A, vOA, vOB;
+ if( false ) {
+ // Fetch only!
+ vC0A = verts1[commonIdxA[0]];
+ vC1A = verts1[commonIdxA[1]];
+ vOA = verts1[otherIdxA];
+ vOB = verts2[otherIdxB];
+ } else {
+ // Fetch and clone, write-back to triangles
+ vC0A = verts1[commonIdxA[0]].clone();
+ verts1[commonIdxA[0]] = vC0A;
+ verts2[commonIdxB[0]] = vC0A;
+ vC1A = verts1[commonIdxA[1]].clone();
+ verts1[commonIdxA[1]] = vC1A;
+ verts2[commonIdxB[1]] = vC1A;
+ vOA = verts1[otherIdxA].clone();
+ verts1[otherIdxA] = vOA;
+ vOB = verts2[otherIdxB].clone();
+ verts2[otherIdxB] = vOB;
+ }
+
+ final float texZTag = 2f;
+ final float[] vOACoords = vOA.getCoord();
+ final float dOC0A = VectorUtil.vec3Distance(vOACoords, vC0A.getCoord());
+ final float dOC1A = VectorUtil.vec3Distance(vOACoords, vC1A.getCoord());
+ if( false ) {
+ final float[] vec3Z = { 0f, 0f, -1f };
+ final float[] vecLongSide, vecLineHeight;
+ if( dOC0A < dOC1A ) {
+ tempV2[0] = dOC0A; // line width
+ tempV2[1] = dOC1A; // long side
+ vecLongSide = VectorUtil.normalizeVec3( VectorUtil.subVec2(tempV3a, vOACoords, vC1A.getCoord()) ); // normal long side vector
+ vecLineHeight = VectorUtil.crossVec3(tempV3b, vec3Z, tempV3a); // the line-height vector (normal)
+ vOA.setTexCoord(-1f, -1f, texZTag);
+ vC1A.setTexCoord(1f, -1f, texZTag);
+ vOB.setTexCoord(0f, 1f, texZTag);
+ vC0A.setTexCoord(0f, 1f, texZTag);
+ } else {
+ tempV2[0] = dOC1A; // line width
+ tempV2[1] = dOC0A; // long side
+ vecLongSide = VectorUtil.normalizeVec3( VectorUtil.subVec2(tempV3a, vOACoords, vC0A.getCoord()) ); // normal long side vector
+ vecLineHeight = VectorUtil.crossVec3(tempV3b, vec3Z, tempV3a); // the line-height vector (normal)
+ }
+ if(CDTriangulator2D.DEBUG){
+ System.err.println("RECT.0 : long-side-vec "+vecLongSide[0]+", "+vecLongSide[1]+", "+vecLongSide[2]);
+ System.err.println("RECT.0 : line-height-vec "+vecLineHeight[0]+", "+vecLineHeight[1]+", "+vecLineHeight[2]);
+ }
+
+ } else {
+ /**
+ * Using method: ROESSLER-2012-OGLES <http://www.cg.tuwien.ac.at/research/publications/2012/ROESSLER-2012-OGLES/>
+ *
+ * Arbitrary but consistently pick left/right and set texCoords, FIXME: validate
+ *
+ * Testing w/ fixed line-width 1, and radius 1/3.
+ */
+ final float lineWidth;
+ final Vertex vL1, vL2, vR1, vR2;
+ if( dOC0A < dOC1A ) {
+ lineWidth = dOC0A; // line width
+ tempV2[0] = dOC0A; // line width
+ tempV2[1] = dOC1A; // long side
+ // Left: vOA, vC1A
+ // Right: vOB, vC0A
+ vL1 = vOA; vL2 = vC1A;
+ vR1 = vOB; vR2 = vC0A;
+ } else {
+ lineWidth = dOC1A; // line width
+ tempV2[0] = dOC1A; // line width
+ tempV2[1] = dOC0A; // long side
+ // Left: vOB, vC1A
+ // Right: vOA, vC0A
+ vL1 = vOB; vL2 = vC1A;
+ vR1 = vOA; vR2 = vC0A;
+ }
+ final float r = lineWidth/3f;
+ final float wa = lineWidth + r;
+ final float waHalf = wa / 2f;
+ vL1.setTexCoord(lineWidth, waHalf, texZTag);
+ vL2.setTexCoord(lineWidth, waHalf, texZTag);
+ vR1.setTexCoord(lineWidth, -waHalf, texZTag);
+ vR2.setTexCoord(lineWidth, -waHalf, texZTag);
+ if(CDTriangulator2D.DEBUG){
+ System.err.println("RECT.0 : lineWidth: "+lineWidth+", dim "+dOC0A+" x "+dOC1A+", radius "+r);
+ System.err.println("RECT Left.0: "+vL1+", "+vL2);
+ System.err.println("RECT Right.0: "+vR1+", "+vR2);
+ }
+ }
+ rect = tempV2;
+ } else {
+ rect = null;
+ }
+ return rect;
+ }
+}
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java b/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java
index 1ef1d8c7f..89ad3edf1 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java
@@ -120,4 +120,8 @@ public class GraphVertex {
public void setBoundaryContained(boolean boundaryContained) {
this.boundaryContained = boundaryContained;
}
+
+ public String toString() {
+ return "GraphVertex[contained "+boundaryContained+", "+point+"]";
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
index f96726e5b..f91c2e77f 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
@@ -49,25 +49,23 @@ public class Loop {
return root;
}
- public Triangle cut(boolean delaunay){
+ public Triangle cut(final boolean delaunay){
if(isSimplex()){
- Triangle t = new Triangle(root.getGraphPoint().getPoint(), root.getNext().getGraphPoint().getPoint(),
- root.getNext().getNext().getGraphPoint().getPoint());
- t.setVerticesBoundary(checkVerticesBoundary(root));
- return t;
+ return new Triangle(root.getGraphPoint().getPoint(), root.getNext().getGraphPoint().getPoint(),
+ root.getNext().getNext().getGraphPoint().getPoint(), checkVerticesBoundary(root));
}
- HEdge prev = root.getPrev();
- HEdge next1 = root.getNext();
+ final HEdge prev = root.getPrev();
+ final HEdge next1 = root.getNext();
- HEdge next2 = findClosestValidNeighbor(next1.getNext(), delaunay);
+ final HEdge next2 = findClosestValidNeighbor(next1.getNext(), delaunay);
if(next2 == null){
root = root.getNext();
return null;
}
- GraphVertex v1 = root.getGraphPoint();
- GraphVertex v2 = next1.getGraphPoint();
- GraphVertex v3 = next2.getGraphPoint();
+ final GraphVertex v1 = root.getGraphPoint();
+ final GraphVertex v2 = next1.getGraphPoint();
+ final GraphVertex v3 = next2.getGraphPoint();
HEdge v3Edge = new HEdge(v3, HEdge.INNER);
@@ -83,7 +81,7 @@ public class Loop {
HEdge.connect(prev, v3EdgeSib);
HEdge.connect(v3EdgeSib, next2);
- Triangle t = createTriangle(v1.getPoint(), v2.getPoint(), v3.getPoint(), root);
+ final Triangle t = createTriangle(v1.getPoint(), v2.getPoint(), v3.getPoint(), root);
this.root = next2;
return t;
}
@@ -272,24 +270,18 @@ public class Loop {
* @return the triangle iff it satisfies, null otherwise
*/
private Triangle createTriangle(Vertex v1, Vertex v2, Vertex v3, HEdge rootT){
- final Triangle t = new Triangle(v1, v2, v3);
- t.setVerticesBoundary(checkVerticesBoundary(rootT));
- return t;
+ return new Triangle(v1, v2, v3, checkVerticesBoundary(rootT));
}
- private boolean[] checkVerticesBoundary(HEdge rootT) {
+ private boolean[] checkVerticesBoundary(final HEdge rootT) {
final boolean[] boundary = new boolean[3];
- HEdge e1 = rootT;
- HEdge e2 = rootT.getNext();
- HEdge e3 = rootT.getNext().getNext();
-
- if(e1.getGraphPoint().isBoundaryContained()){
+ if(rootT.getGraphPoint().isBoundaryContained()){
boundary[0] = true;
}
- if(e2.getGraphPoint().isBoundaryContained()){
+ if(rootT.getNext().getGraphPoint().isBoundaryContained()){
boundary[1] = true;
}
- if(e3.getGraphPoint().isBoundaryContained()){
+ if(rootT.getNext().getNext().getGraphPoint().isBoundaryContained()){
boundary[2] = true;
}
return boundary;
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java
index 6768b18c3..0e17eab3d 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java
@@ -29,6 +29,7 @@ package jogamp.graph.font.typecast;
import jogamp.graph.font.typecast.ot.OTGlyph;
import jogamp.graph.font.typecast.ot.Point;
+import jogamp.opengl.Debug;
import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.geom.Vertex;
@@ -42,7 +43,7 @@ import com.jogamp.graph.geom.Vertex.Factory;
* http://walon.org/pub/ttf/ttf_glyphs.htm
*/
public class TypecastRenderer {
- private static final boolean DEBUG = false;
+ private static final boolean DEBUG = Debug.debug("graph.font.Renderer");
private static void addShapeMoveTo(final OutlineShape shape, Factory<? extends Vertex> vertexFactory, Point p1) {
shape.closeLastOutline(false);