aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-03-22 06:23:50 +0100
committerSven Gothel <[email protected]>2014-03-22 06:23:50 +0100
commitb4817d053d7af20dae33774e430bf79a3d3c6fcd (patch)
tree1e7cd3d713e3c1f8442f00be8d161a63de34f601 /src
parent523d1dae2431fdd56d39d3ea06220cfed412a0b5 (diff)
Bug 801: Revise Graph VBAA (Add border dropping MSAA; Test diff. AA modes incl. FXAA2) ; Test exp. LineAA ; Misc Changes
- Revise VBAA - Add border to FBO dropping MSAA - This automatically gives AA for edges on FBO boundary - Correcting ceil-diff, use object-diff instead of win-diff (diff := ceil(a)-a, w/ float a) - Reorg shader - using includes to test diff. AA modes: - [poles, wholeedge] * [equalweight, propweight] - fxaa2 - Exp. LineAA (disabled) - Test ROESSLER-2012-OGLES for detected rectangles only - Test boundary line detection See screenshots: <http://jogamp.org/files/screenshots/graphui/20140322/>
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/Region.java2
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java16
-rw-r--r--src/jogl/classes/com/jogamp/graph/geom/SVertex.java17
-rw-r--r--src/jogl/classes/com/jogamp/graph/geom/Triangle.java39
-rw-r--r--src/jogl/classes/com/jogamp/graph/geom/Vertex.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/Quaternion.java8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java92
-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
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java12
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java)56
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo02.java90
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionRendererListenerBase01.java52
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo03.java)52
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java86
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java106
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java1
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java90
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo01.java48
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo02.java47
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java20
51 files changed, 1680 insertions, 1025 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/Region.java b/src/jogl/classes/com/jogamp/graph/curve/Region.java
index bb0ed09d1..15a0d6bff 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/Region.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/Region.java
@@ -48,7 +48,7 @@ public abstract class Region {
/** Debug flag for region impl (graph.curve) */
public static final boolean DEBUG = Debug.debug("graph.curve");
- public static final boolean DEBUG_INSTANCE = Debug.debug("graph.curve.instance");
+ public static final boolean DEBUG_INSTANCE = Debug.debug("graph.curve.Instance");
/**
* Rendering-Mode bit for {@link Region#getRenderModes() Region} and {@link com.jogamp.graph.curve.opengl.RegionRenderer#getRenderModes() RegionRenderer}.
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
index bc9052dbe..8233d4262 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
@@ -121,20 +121,22 @@ public abstract class RegionRenderer {
return new jogamp.graph.curve.opengl.RegionRendererImpl01(rs, renderModes, enableCallback, disableCallback);
}
- protected final int renderModes;
- protected final RenderState rs;
+ private final int renderModes;
+ private final RenderState rs;
- protected final GLCallback enableCallback;
- protected final GLCallback disableCallback;
+ private final GLCallback enableCallback;
+ private final GLCallback disableCallback;
- protected int vp_width;
- protected int vp_height;
- protected boolean initialized;
+ private int vp_width;
+ private int vp_height;
+ private boolean initialized;
private boolean vboSupported = false;
public final boolean isInitialized() { return initialized; }
+ /** Return width of current viewport */
public final int getWidth() { return vp_width; }
+ /** Return height of current viewport */
public final int getHeight() { return vp_height; }
public final float getWeight() { return rs.getWeight().floatValue(); }
diff --git a/src/jogl/classes/com/jogamp/graph/geom/SVertex.java b/src/jogl/classes/com/jogamp/graph/geom/SVertex.java
index beac908d4..d13607d71 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/SVertex.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/SVertex.java
@@ -36,9 +36,9 @@ import com.jogamp.opengl.math.VectorUtil;
*/
public class SVertex implements Vertex {
private int id;
- protected final float[] coord = new float[3];
protected boolean onCurve;
- private final float[] texCoord = new float[2];
+ protected final float[] coord = new float[3];
+ private final float[] texCoord = new float[3];
static final Factory factory = new Factory();
@@ -78,13 +78,13 @@ public class SVertex implements Vertex {
this.id = src.getId();
System.arraycopy(src.getCoord(), 0, coord, 0, 3);
setOnCurve(src.isOnCurve());
- System.arraycopy(src.getTexCoord(), 0, texCoord, 0, 2);
+ System.arraycopy(src.getTexCoord(), 0, texCoord, 0, 3);
}
public SVertex(final int id, final boolean onCurve, final float[] texCoordsBuffer) {
this.id = id;
this.onCurve = onCurve;
- System.arraycopy(texCoordsBuffer, 0, texCoord, 0, 2);
+ System.arraycopy(texCoordsBuffer, 0, texCoord, 0, 3);
}
public SVertex(final float x, final float y, final float z, final boolean onCurve) {
@@ -102,7 +102,7 @@ public class SVertex implements Vertex {
public SVertex(float[] coordsBuffer, float[] texCoordsBuffer, boolean onCurve) {
this.id = Integer.MAX_VALUE;
System.arraycopy(coordsBuffer, 0, coord, 0, 3);
- System.arraycopy(texCoordsBuffer, 0, texCoord, 0, 2);
+ System.arraycopy(texCoordsBuffer, 0, texCoord, 0, 3);
setOnCurve(onCurve);
}
@@ -189,7 +189,7 @@ public class SVertex implements Vertex {
final Vertex v = (Vertex) obj;
return this == v ||
isOnCurve() == v.isOnCurve() &&
- VectorUtil.isVec2Equal(getTexCoord(), 0, v.getTexCoord(), 0, FloatUtil.EPSILON) &&
+ VectorUtil.isVec3Equal(getTexCoord(), 0, v.getTexCoord(), 0, FloatUtil.EPSILON) &&
VectorUtil.isVec3Equal(getCoord(), 0, v.getCoord(), 0, FloatUtil.EPSILON) ;
}
@@ -199,9 +199,10 @@ public class SVertex implements Vertex {
}
@Override
- public final void setTexCoord(float s, float t) {
+ public final void setTexCoord(float s, float t, float p) {
texCoord[0] = s;
texCoord[1] = t;
+ texCoord[2] = p;
}
@Override
@@ -221,6 +222,6 @@ public class SVertex implements Vertex {
public String toString() {
return "[ID: " + id + ", onCurve: " + onCurve +
": p " + coord[0] + ", " + coord[1] + ", " + coord[2] +
- ", t " + texCoord[0] + ", " + texCoord[1] + "]";
+ ", t " + texCoord[0] + ", " + texCoord[1] + ", " + texCoord[2] + "]";
}
}
diff --git a/src/jogl/classes/com/jogamp/graph/geom/Triangle.java b/src/jogl/classes/com/jogamp/graph/geom/Triangle.java
index de629dfc4..33e53f3ed 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/Triangle.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/Triangle.java
@@ -27,6 +27,8 @@
*/
package com.jogamp.graph.geom;
+import com.jogamp.opengl.math.VectorUtil;
+
import jogamp.graph.geom.plane.AffineTransform;
public class Triangle {
@@ -35,31 +37,29 @@ public class Triangle {
private boolean[] boundaryVertices = null;
private int id;
- public Triangle(Vertex v1, Vertex v2, Vertex v3) {
+ public Triangle(final Vertex v1, final Vertex v2, final Vertex v3, final boolean[] boundaryVertices) {
id = Integer.MAX_VALUE;
vertices[0] = v1;
vertices[1] = v2;
vertices[2] = v3;
+ this.boundaryVertices = boundaryVertices;
}
- public Triangle(Triangle src) {
+ public Triangle(final Triangle src) {
id = src.id;
vertices[0] = src.vertices[0].clone();
vertices[1] = src.vertices[1].clone();
vertices[2] = src.vertices[2].clone();
System.arraycopy(src.boundaryEdges, 0, boundaryEdges, 0, 3);
- boundaryVertices = src.boundaryVertices;
+ boundaryVertices = new boolean[3];
+ System.arraycopy(src.boundaryVertices, 0, boundaryVertices, 0, 3);
}
private Triangle(final int id, final boolean[] boundaryEdges, final boolean[] boundaryVertices){
this.id = id;
System.arraycopy(boundaryEdges, 0, this.boundaryEdges, 0, 3);
- this.boundaryVertices = boundaryVertices;
- /**
- if( null != boundaryVertices ) {
- this.boundaryVertices = new boolean[3];
- System.arraycopy(boundaryVertices, 0, this.boundaryVertices, 0, 3);
- } */
+ this.boundaryVertices = new boolean[3];
+ System.arraycopy(boundaryVertices, 0, this.boundaryVertices, 0, 3);
}
/**
@@ -73,6 +73,22 @@ public class Triangle {
return tri;
}
+ /**
+ * Returns true if all vertices are on-curve, otherwise false.
+ */
+ public final boolean isOnCurve() {
+ return vertices[0].isOnCurve() && vertices[1].isOnCurve() && vertices[2].isOnCurve();
+ }
+
+ /**
+ * Returns true if all vertices are lines, i.e. zero tex-coord, otherwise false.
+ */
+ public final boolean isLine() {
+ return VectorUtil.isVec2Zero(vertices[0].getTexCoord(), 0) &&
+ VectorUtil.isVec2Zero(vertices[1].getTexCoord(), 0) &&
+ VectorUtil.isVec2Zero(vertices[2].getTexCoord(), 0) ;
+ }
+
public int getId() {
return id;
}
@@ -108,6 +124,9 @@ public class Triangle {
@Override
public String toString() {
- return "Tri ID: " + id + "\n\t" + vertices[0] + "\n\t" + vertices[1] + "\n\t" + vertices[2];
+ return "Tri ID: " + id + ", onCurve "+isOnCurve()+"\n\t" +
+ vertices[0] + ", bound "+boundaryVertices[0]+"\n\t" +
+ vertices[1] + ", bound "+boundaryVertices[1]+"\n\t" +
+ vertices[2] + ", bound "+boundaryVertices[2];
}
}
diff --git a/src/jogl/classes/com/jogamp/graph/geom/Vertex.java b/src/jogl/classes/com/jogamp/graph/geom/Vertex.java
index fc9590ae7..e9c8dd193 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/Vertex.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/Vertex.java
@@ -69,7 +69,7 @@ public interface Vertex extends Vert3fImmutable, Cloneable {
float[] getTexCoord();
- void setTexCoord(float s, float t);
+ void setTexCoord(float s, float t, float p);
/**
* @see System#arraycopy(Object, int, Object, int, int) for thrown IndexOutOfBoundsException
diff --git a/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java b/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java
index cc2a3a1cc..345224788 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java
@@ -649,7 +649,7 @@ public class Quaternion {
* @return this quaternion for chaining.
*/
public final Quaternion setFromVectors(final float[] v1, final float[] v2, final float[] tmpPivotVec, final float[] tmpNormalVec) {
- final float factor = VectorUtil.vec3Length(v1) * VectorUtil.vec3Length(v2);
+ final float factor = VectorUtil.vec3Norm(v1) * VectorUtil.vec3Norm(v2);
if ( FloatUtil.isZero(factor, FloatUtil.EPSILON ) ) {
return setIdentity();
} else {
@@ -658,7 +658,7 @@ public class Quaternion {
VectorUtil.crossVec3(tmpPivotVec, v1, v2);
- if ( dot < 0.0f && FloatUtil.isZero( VectorUtil.vec3Length(tmpPivotVec), FloatUtil.EPSILON ) ) {
+ if ( dot < 0.0f && FloatUtil.isZero( VectorUtil.vec3Norm(tmpPivotVec), FloatUtil.EPSILON ) ) {
// Vectors parallel and opposite direction, therefore a rotation of 180 degrees about any vector
// perpendicular to this vector will rotate vector a onto vector b.
//
@@ -704,7 +704,7 @@ public class Quaternion {
* @return this quaternion for chaining.
*/
public final Quaternion setFromNormalVectors(final float[] v1, final float[] v2, final float[] tmpPivotVec) {
- final float factor = VectorUtil.vec3Length(v1) * VectorUtil.vec3Length(v2);
+ final float factor = VectorUtil.vec3Norm(v1) * VectorUtil.vec3Norm(v2);
if ( FloatUtil.isZero(factor, FloatUtil.EPSILON ) ) {
return setIdentity();
} else {
@@ -713,7 +713,7 @@ public class Quaternion {
VectorUtil.crossVec3(tmpPivotVec, v1, v2);
- if ( dot < 0.0f && FloatUtil.isZero( VectorUtil.vec3Length(tmpPivotVec), FloatUtil.EPSILON ) ) {
+ if ( dot < 0.0f && FloatUtil.isZero( VectorUtil.vec3Norm(tmpPivotVec), FloatUtil.EPSILON ) ) {
// Vectors parallel and opposite direction, therefore a rotation of 180 degrees about any vector
// perpendicular to this vector will rotate vector a onto vector b.
//
diff --git a/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java b/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
index 9c6da7e24..7fa6f2d60 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
@@ -45,6 +45,20 @@ public class VectorUtil {
}
/**
+ * Copies a vector of length 2
+ * @param dst output vector
+ * @param dstOffset offset of dst in array
+ * @param src input vector
+ * @param srcOffset offset of src in array
+ * @return copied output vector for chaining
+ */
+ public static float[] copyVec2(final float[] dst, int dstOffset, final float[] src, int srcOffset)
+ {
+ System.arraycopy(src, srcOffset, dst, dstOffset, 2);
+ return dst;
+ }
+
+ /**
* Copies a vector of length 3
* @param dst output vector
* @param dstOffset offset of dst in array
@@ -121,6 +135,13 @@ public class VectorUtil {
/**
* Return true if vector is zero, no {@link FloatUtil#EPSILON} is taken into consideration.
*/
+ public static boolean isVec2Zero(final float[] vec, final int vecOffset) {
+ return 0f == vec[0+vecOffset] && 0f == vec[1+vecOffset];
+ }
+
+ /**
+ * Return true if vector is zero, no {@link FloatUtil#EPSILON} is taken into consideration.
+ */
public static boolean isVec3Zero(final float[] vec, final int vecOffset) {
return 0f == vec[0+vecOffset] && 0f == vec[1+vecOffset] && 0f == vec[2+vecOffset];
}
@@ -131,11 +152,32 @@ public class VectorUtil {
* Implementation uses {@link FloatUtil#isZero(float, float)}, see API doc for details.
* </p>
*/
+ public static boolean isVec2Zero(final float[] vec, final int vecOffset, final float epsilon) {
+ return isZero(vec[0+vecOffset], vec[1+vecOffset], epsilon);
+ }
+
+ /**
+ * Return true if vector is zero, i.e. it's absolute components < <code>epsilon</code>.
+ * <p>
+ * Implementation uses {@link FloatUtil#isZero(float, float)}, see API doc for details.
+ * </p>
+ */
public static boolean isVec3Zero(final float[] vec, final int vecOffset, final float epsilon) {
return isZero(vec[0+vecOffset], vec[1+vecOffset], vec[2+vecOffset], epsilon);
}
/**
+ * Return true if all two vector components are zero, i.e. it's their absolute value < <code>epsilon</code>.
+ * <p>
+ * Implementation uses {@link FloatUtil#isZero(float, float)}, see API doc for details.
+ * </p>
+ */
+ public static boolean isZero(final float x, final float y, final float epsilon) {
+ return FloatUtil.isZero(x, epsilon) &&
+ FloatUtil.isZero(y, epsilon) ;
+ }
+
+ /**
* Return true if all three vector components are zero, i.e. it's their absolute value < <code>epsilon</code>.
* <p>
* Implementation uses {@link FloatUtil#isZero(float, float)}, see API doc for details.
@@ -174,22 +216,39 @@ public class VectorUtil {
* @param vec2 vector 2
* @return the dot product as float
*/
- public static float vec3Dot(final float[] vec1, final float[] vec2)
- {
+ public static float vec3Dot(final float[] vec1, final float[] vec2) {
return vec1[0]*vec2[0] + vec1[1]*vec2[1] + vec1[2]*vec2[2];
}
/**
- * Compute the squared length of a vector, a.k.a the squared <i>norm</i>
+ * Compute the cos of the angle between to vectors
+ * @param vec1 vector 1
+ * @param vec2 vector 2
+ */
+ public static float vec3CosAngle(final float[] vec1, final float[] vec2) {
+ return vec3Dot(vec1, vec2) / ( vec3Norm(vec1) * vec3Norm(vec2) ) ;
+ }
+
+ /**
+ * Compute the angle between to vectors in radians
+ * @param vec1 vector 1
+ * @param vec2 vector 2
+ */
+ public static float vec3Angle(final float[] vec1, final float[] vec2) {
+ return FloatUtil.acos(vec3CosAngle(vec1, vec2));
+ }
+
+ /**
+ * Compute the squared length of a vector, a.k.a the squared <i>norm</i> or squared <i>magnitude</i>
*/
- public static float vec3LengthSquare(final float[] vec) {
+ public static float vec3NormSquare(final float[] vec) {
return vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2];
}
/**
- * Compute the length of a vector, a.k.a the <i>norm</i>
+ * Compute the length of a vector, a.k.a the <i>norm</i> or <i>magnitude</i>
*/
- public static float vec3Length(final float[] vec) {
- return FloatUtil.sqrt(vec3LengthSquare(vec));
+ public static float vec3Norm(final float[] vec) {
+ return FloatUtil.sqrt(vec3NormSquare(vec));
}
/**
@@ -200,7 +259,7 @@ public class VectorUtil {
* @return result vector for chaining
*/
public static float[] normalizeVec3(final float[] result, final float[] vector) {
- final float lengthSq = vec3LengthSquare(vector);
+ final float lengthSq = vec3NormSquare(vector);
if ( FloatUtil.isZero(lengthSq, FloatUtil.EPSILON) ) {
result[0] = 0f;
result[1] = 0f;
@@ -220,7 +279,7 @@ public class VectorUtil {
* @return normalized output vector
*/
public static float[] normalizeVec3(final float[] vector) {
- final float lengthSq = vec3LengthSquare(vector);
+ final float lengthSq = vec3NormSquare(vector);
if ( FloatUtil.isZero(lengthSq, FloatUtil.EPSILON) ) {
vector[0] = 0f;
vector[1] = 0f;
@@ -279,6 +338,19 @@ public class VectorUtil {
/**
* Subtracts two vectors, result = v1 - v2
+ * @param result float[2] result vector, may be either v1 or v2 (in-place)
+ * @param v1 vector 1
+ * @param v2 vector 2
+ * @return result vector for chaining
+ */
+ public static float[] subVec2(final float[] result, final float[] v1, final float[] v2) {
+ result[0] = v1[0] - v2[0];
+ result[1] = v1[1] - v2[1];
+ return result;
+ }
+
+ /**
+ * Subtracts two vectors, result = v1 - v2
* @param result float[3] result vector, may be either v1 or v2 (in-place)
* @param v1 vector 1
* @param v2 vector 2
@@ -342,7 +414,7 @@ public class VectorUtil {
* @return midpoint
*/
public static float mid(final float p1, final float p2) {
- return (p1+p2)/2.0f;
+ return (p1+p2)*0.5f;
}
/**
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);
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java b/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java
index de5fe8eb2..55a043a14 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java
@@ -48,7 +48,7 @@ import com.jogamp.graph.geom.SVertex;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.graph.demos.GPURegionGLListener01;
import com.jogamp.opengl.test.junit.graph.demos.GPURegionGLListener02;
-import com.jogamp.opengl.test.junit.graph.demos.GPURegionRendererListenerBase01;
+import com.jogamp.opengl.test.junit.graph.demos.GPURendererListenerBase01;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.glsl.ShaderState;
@@ -247,9 +247,9 @@ public class TestRegionRendererNEWT01 extends UITestCase {
private class RegionGLListener implements GLEventListener {
String winTitle;
String name;
- GPURegionRendererListenerBase01 impl;
+ GPURendererListenerBase01 impl;
- public RegionGLListener(GPURegionRendererListenerBase01 impl, String title, String name) {
+ public RegionGLListener(GPURendererListenerBase01 impl, String title, String name) {
this.impl = impl;
this.winTitle = title;
this.name = name;
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java
index 905483e7f..d7696f36b 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java
@@ -167,6 +167,10 @@ public class TestTextRendererNEWT00 extends UITestCase {
}
@Test
+ public void test00SceneNoAA() throws InterruptedException {
+ testImpl(0, 0, 0);
+ }
+ @Test
public void test01SceneMSAA01() throws InterruptedException {
if( SceneMSAASamples > 0 ) {
testImpl(SceneMSAASamples, 0, 0);
@@ -373,9 +377,11 @@ public class TestTextRendererNEWT00 extends UITestCase {
lfps, tfps, gl.getSwapInterval(), (t1-t0)/1000.0, fontSizeAnim,
drawable.getChosenGLCapabilities().getNumSamples(), modeS, vbaaSampleCount[0]);
- if( false ) {
- // renderString(drawable, font, pixelSize, getFontInfo(), 0, 0, 0, 0, -1000f, true);
- renderString(drawable, font, pixelSize, textX2, 0, 0, 0, 0, -1000f, true);
+ if( true ) {
+ renderString(drawable, font, pixelSize, "I - / H P 7 0", 0, 0, 0, 0, -1000f, true);
+ // renderString(drawable, font, pixelSize, "I/- 0", 0, 0, 0, 0, -1000f, true);
+ // renderString(drawable, font, pixelSize, "012345678901234567890123456789", 0, 0, 0, -1000, true);
+ // renderString(drawable, font, pixelSize, textX2, 0, 0, 0, 0, -1000f, true);
// renderString(drawable, font, pixelSize, text1, 0, 0, 0, -1000f, regionFPS); // no-cache
} else {
renderString(drawable, font, pixelSize, getFontInfo(), 0, 0, 0, 0, -1000, true);
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java
index feab048ea..f14da399e 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java
@@ -46,11 +46,11 @@ import com.jogamp.opengl.util.PMVMatrix;
* are on the curve. Demos the Res. Independent Nurbs based Curve rendering
*
*/
-public class GPURegionGLListener01 extends GPURegionRendererListenerBase01 {
+public class GPURegionGLListener01 extends GPURendererListenerBase01 {
OutlineShape outlineShape = null;
public GPURegionGLListener01 (RenderState rs, int renderModes, int sampleCount, boolean debug, boolean trace) {
- super(rs, renderModes, debug, trace);
+ super(RegionRenderer.create(rs, renderModes, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), renderModes, debug, trace);
setMatrix(-20, 00, -50, 0f, sampleCount);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java
index 8fbc73522..23ccef640 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java
@@ -46,11 +46,11 @@ import com.jogamp.opengl.util.PMVMatrix;
* into one region
*
*/
-public class GPURegionGLListener02 extends GPURegionRendererListenerBase01 {
+public class GPURegionGLListener02 extends GPURendererListenerBase01 {
List<OutlineShape> outlineShapes = new ArrayList<OutlineShape>();
public GPURegionGLListener02 (RenderState rs, int renderModes, int sampleCount, boolean debug, boolean trace) {
- super(rs, renderModes, debug, trace);
+ super(RegionRenderer.create(rs, renderModes, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), renderModes, debug, trace);
setMatrix(-20, 00, -50, 0f, sampleCount);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo.java
index c6c4b62ce..7bcbe0484 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo.java
@@ -39,6 +39,7 @@ import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.glsl.ShaderState;
@@ -49,25 +50,70 @@ import com.jogamp.opengl.util.glsl.ShaderState;
* are on the curve. Demos the Res. Independent Nurbs based Curve rendering
*
*/
-public class GPURegionNewtDemo01 {
+public class GPURegionNewtDemo {
static final boolean DEBUG = false;
static final boolean TRACE = false;
+ static int SceneMSAASamples = 0;
+ static int GraphVBAASamples = 4;
+ static int GraphMSAASamples = 0;
+ static boolean GraphUseWeight = true;
+
public static void main(String[] args) {
+ if( 0 != args.length ) {
+ SceneMSAASamples = 0;
+ GraphMSAASamples = 0;
+ GraphVBAASamples = 0;
+ GraphUseWeight = false;
+
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-smsaa")) {
+ i++;
+ SceneMSAASamples = MiscUtils.atoi(args[i], SceneMSAASamples);
+ } else if(args[i].equals("-gmsaa")) {
+ i++;
+ GraphMSAASamples = MiscUtils.atoi(args[i], GraphMSAASamples);
+ GraphVBAASamples = 0;
+ } else if(args[i].equals("-gvbaa")) {
+ i++;
+ GraphMSAASamples = 0;
+ GraphVBAASamples = MiscUtils.atoi(args[i], GraphVBAASamples);
+ } else if(args[i].equals("-gweight")) {
+ GraphUseWeight = true;
+ }
+ }
+ }
+ System.err.println("Scene MSAA Samples "+SceneMSAASamples);
+ System.err.println("Graph MSAA Samples"+GraphMSAASamples);
+ System.err.println("Graph VBAA Samples "+GraphVBAASamples);
+ System.err.println("Graph Weight Mode "+GraphUseWeight);
+
GLProfile glp = GLProfile.getGL2ES2();
GLCapabilities caps = new GLCapabilities(glp);
caps.setAlphaBits(4);
- caps.setSampleBuffers(true);
- caps.setNumSamples(4); // 2 samples is not enough ..
+ if( SceneMSAASamples > 0 ) {
+ caps.setSampleBuffers(true);
+ caps.setNumSamples(SceneMSAASamples);
+ }
System.out.println("Requested: " + caps);
+ int rmode = GraphUseWeight ? Region.VARIABLE_CURVE_WEIGHT_BIT : 0;
+ int sampleCount = 0;
+ if( GraphVBAASamples > 0 ) {
+ rmode |= Region.VBAA_RENDERING_BIT;
+ sampleCount += GraphVBAASamples;
+ } else if( GraphMSAASamples > 0 ) {
+ rmode |= Region.MSAA_RENDERING_BIT;
+ sampleCount += GraphMSAASamples;
+ }
+
final GLWindow window = GLWindow.create(caps);
window.setPosition(10, 10);
window.setSize(800, 400);
- window.setTitle("GPU Curve Region Newt Demo 01 - vbaa0 msaa1");
+ window.setTitle("GPU Curve Region Newt Demo - graph[vbaa"+GraphVBAASamples+" msaa"+GraphMSAASamples+"], msaa "+SceneMSAASamples);
RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory());
- GPURegionGLListener01 regionGLListener = new GPURegionGLListener01 (rs, Region.VARIABLE_CURVE_WEIGHT_BIT, 0, DEBUG, TRACE);
+ GPURegionGLListener01 regionGLListener = new GPURegionGLListener01 (rs, rmode, sampleCount, DEBUG, TRACE);
regionGLListener.attachInputListenerTo(window);
window.addGLEventListener(regionGLListener);
window.setVisible(true);
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo02.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo02.java
deleted file mode 100644
index e7bd59aeb..000000000
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo02.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * Copyright 2010 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 com.jogamp.opengl.test.junit.graph.demos;
-
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLProfile;
-
-import com.jogamp.graph.curve.Region;
-import com.jogamp.graph.curve.opengl.RenderState;
-import com.jogamp.graph.geom.SVertex;
-import com.jogamp.newt.event.KeyAdapter;
-import com.jogamp.newt.event.KeyEvent;
-import com.jogamp.newt.event.WindowAdapter;
-import com.jogamp.newt.event.WindowEvent;
-import com.jogamp.newt.opengl.GLWindow;
-import com.jogamp.opengl.util.Animator;
-import com.jogamp.opengl.util.glsl.ShaderState;
-
-/** Demonstrate the rendering of multiple OutlineShapes
- * into one region
- *
- */
-public class GPURegionNewtDemo02 {
- static final boolean DEBUG = false;
- static final boolean TRACE = false;
-
- public static void main(String[] args) {
- GLProfile glp = GLProfile.getGL2ES2();
- GLCapabilities caps = new GLCapabilities(glp);
- caps.setAlphaBits(4);
- System.out.println("Requested: " + caps);
-
- final GLWindow window = GLWindow.create(caps);
- window.setPosition(10, 10);
- window.setSize(800, 400);
- window.setTitle("GPU Curve Region Newt Demo 02 - vbaa1 msaa0");
-
- RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory());
- GPURegionGLListener02 regionGLListener = new GPURegionGLListener02 (rs, Region.VBAA_RENDERING_BIT|Region.VARIABLE_CURVE_WEIGHT_BIT, 4, DEBUG, TRACE);
- regionGLListener.attachInputListenerTo(window);
- window.addGLEventListener(regionGLListener);
- window.setVisible(true);
-
- //FPSAnimator animator = new FPSAnimator(60);
- final Animator animator = new Animator();
- animator.setUpdateFPSFrames(60, System.err);
- animator.add(window);
-
- window.addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent arg0) {
- if(arg0.getKeyCode() == KeyEvent.VK_F4) {
- window.destroy();
- }
- }
- });
- window.addWindowListener(new WindowAdapter() {
- public void windowDestroyed(WindowEvent e) {
- animator.stop();
- }
- });
-
- animator.start();
- }
-}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionRendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionRendererListenerBase01.java
deleted file mode 100644
index 9ececa082..000000000
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionRendererListenerBase01.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Copyright 2010 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 com.jogamp.opengl.test.junit.graph.demos;
-
-import com.jogamp.graph.curve.OutlineShape;
-import com.jogamp.graph.curve.opengl.RegionRenderer;
-import com.jogamp.graph.curve.opengl.RenderState;
-
-/**
- *
- * Action Keys:
- * - 1/2: zoom in/out
- * - 3/4: font +/-
- * - 6/7: 2nd pass texture size
- * - 0/9: rotate
- * - s: toogle draw 'font set'
- * - f: toggle draw fps
- * - v: toggle v-sync
- * - space: toggle font (ubuntu/java)
- */
-public abstract class GPURegionRendererListenerBase01 extends GPURendererListenerBase01 {
- OutlineShape outlineShape = null;
-
- public GPURegionRendererListenerBase01(RenderState rs, int renderModes, boolean debug, boolean trace) {
- super(RegionRenderer.create(rs, renderModes, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), renderModes, debug, trace);
- }
-}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo03.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java
index 9174d69af..45d7dd343 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo03.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java
@@ -38,10 +38,11 @@ import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.glsl.ShaderState;
-public class GPUTextNewtDemo03 {
+public class GPUTextNewtDemo {
/**
* FIXME:
*
@@ -55,21 +56,62 @@ public class GPUTextNewtDemo03 {
static final boolean DEBUG = false;
static final boolean TRACE = false;
+ static int SceneMSAASamples = 0;
+ static int GraphVBAASamples = 4;
+ static int GraphMSAASamples = 0;
+
public static void main(String[] args) {
+ if( 0 != args.length ) {
+ SceneMSAASamples = 0;
+ GraphMSAASamples = 0;
+ GraphVBAASamples = 0;
+
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-smsaa")) {
+ i++;
+ SceneMSAASamples = MiscUtils.atoi(args[i], SceneMSAASamples);
+ } else if(args[i].equals("-gmsaa")) {
+ i++;
+ GraphMSAASamples = MiscUtils.atoi(args[i], GraphMSAASamples);
+ GraphVBAASamples = 0;
+ } else if(args[i].equals("-gvbaa")) {
+ i++;
+ GraphMSAASamples = 0;
+ GraphVBAASamples = MiscUtils.atoi(args[i], GraphVBAASamples);
+ }
+ }
+ }
+ System.err.println("Scene MSAA Samples "+SceneMSAASamples);
+ System.err.println("Graph MSAA Samples "+GraphMSAASamples);
+ System.err.println("Graph VBAA Samples "+GraphVBAASamples);
+
GLProfile glp = GLProfile.getGL2ES2();
GLCapabilities caps = new GLCapabilities(glp);
caps.setAlphaBits(4);
- System.out.println("Requested: "+caps);
+ if( SceneMSAASamples > 0 ) {
+ caps.setSampleBuffers(true);
+ caps.setNumSamples(SceneMSAASamples);
+ }
+ System.out.println("Requested: " + caps);
- final GLWindow window = GLWindow.create(caps);
+ int rmode = Region.VARIABLE_CURVE_WEIGHT_BIT;
+ int sampleCount = 0;
+ if( GraphVBAASamples > 0 ) {
+ rmode |= Region.VBAA_RENDERING_BIT;
+ sampleCount += GraphVBAASamples;
+ } else if( GraphMSAASamples > 0 ) {
+ rmode |= Region.MSAA_RENDERING_BIT;
+ sampleCount += GraphMSAASamples;
+ }
+ final GLWindow window = GLWindow.create(caps);
window.setPosition(10, 10);
window.setSize(800, 400);
- window.setTitle("GPU Text Newt Demo 03 - gvbaa0 gmsaa4");
+ window.setTitle("GPU Text Newt Demo - graph[vbaa"+GraphVBAASamples+" msaa"+GraphMSAASamples+"], msaa "+SceneMSAASamples);
RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory());
- GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(rs, Region.MSAA_RENDERING_BIT, 4, true, DEBUG, TRACE);
+ GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(rs, rmode, sampleCount, true, DEBUG, TRACE);
// ((TextRenderer)textGLListener.getRenderer()).setCacheLimit(32);
window.addGLEventListener(textGLListener);
window.setVisible(true);
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java
deleted file mode 100644
index de06310d7..000000000
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * Copyright 2010 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 com.jogamp.opengl.test.junit.graph.demos;
-
-
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLProfile;
-
-import com.jogamp.graph.curve.opengl.RenderState;
-import com.jogamp.graph.geom.SVertex;
-import com.jogamp.newt.event.KeyAdapter;
-import com.jogamp.newt.event.KeyEvent;
-import com.jogamp.newt.event.WindowAdapter;
-import com.jogamp.newt.event.WindowEvent;
-import com.jogamp.newt.opengl.GLWindow;
-import com.jogamp.opengl.util.Animator;
-import com.jogamp.opengl.util.glsl.ShaderState;
-
-public class GPUTextNewtDemo01 {
- static final boolean DEBUG = false;
- static final boolean TRACE = false;
-
- public static void main(String[] args) {
- GLProfile glp = GLProfile.getGL2ES2();
- GLCapabilities caps = new GLCapabilities(glp);
- caps.setAlphaBits(4);
- caps.setSampleBuffers(true);
- caps.setNumSamples(4); // 2 samples is not enough ..
- System.out.println("Requested: "+caps);
-
- final GLWindow window = GLWindow.create(caps);
- window.setPosition(10, 10);
- window.setSize(800, 400);
- window.setTitle("GPU Text Newt Demo 01 - smsaa1");
-
- final RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory());
- GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(rs, 0, 0, true, DEBUG, TRACE);
- window.addGLEventListener(textGLListener);
-
- final Animator animator = new Animator();
- animator.setUpdateFPSFrames(60, System.err);
- animator.add(window);
-
- window.addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent arg0) {
- if(arg0.getKeyCode() == KeyEvent.VK_F4) {
- window.destroy();
- }
- }
- });
- window.addWindowListener(new WindowAdapter() {
- public void windowDestroyed(WindowEvent e) {
- animator.stop();
- }
- });
-
- window.setVisible(true);
- // FPSAnimator animator = new FPSAnimator(10);
- animator.start();
- }
-}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java
deleted file mode 100644
index 3dc03788b..000000000
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * Copyright 2010 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 com.jogamp.opengl.test.junit.graph.demos;
-
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLProfile;
-
-import com.jogamp.graph.curve.Region;
-import com.jogamp.graph.curve.opengl.RenderState;
-import com.jogamp.graph.geom.SVertex;
-import com.jogamp.newt.event.KeyAdapter;
-import com.jogamp.newt.event.KeyEvent;
-import com.jogamp.newt.event.WindowAdapter;
-import com.jogamp.newt.event.WindowEvent;
-import com.jogamp.newt.opengl.GLWindow;
-import com.jogamp.opengl.util.Animator;
-import com.jogamp.opengl.util.glsl.ShaderState;
-
-public class GPUTextNewtDemo02 {
- /**
- * FIXME:
- *
- * If DEBUG is enabled:
- *
- * Caused by: javax.media.opengl.GLException: Thread[main-Display-X11_:0.0-1-EDT-1,5,main] glGetError() returned the following error codes after a call to glFramebufferRenderbuffer(<int> 0x8D40, <int> 0x1902, <int> 0x8D41, <int> 0x1): GL_INVALID_ENUM ( 1280 0x500),
- * at javax.media.opengl.DebugGL4bc.checkGLGetError(DebugGL4bc.java:33961)
- * at javax.media.opengl.DebugGL4bc.glFramebufferRenderbuffer(DebugGL4bc.java:33077)
- * at jogamp.graph.curve.opengl.VBORegion2PGL3.initFBOTexture(VBORegion2PGL3.java:295)
- */
- static final boolean DEBUG = false;
- static final boolean TRACE = false;
-
- public static void main(String[] args) {
- boolean alpha = true;
- boolean blending = true;
- for(int i=0; i<args.length; i++) {
- if(args[i].equals("-noblend")) {
- blending = false;
- } else if(args[i].equals("-noalpha")) {
- alpha = false;
- }
- }
-
- final GLProfile glp = GLProfile.getGL2ES2();
-
- GLCapabilities caps = new GLCapabilities(glp);
- caps.setAlphaBits( alpha ? 4 : 0 );
- System.out.println("Requested: "+caps);
-
- final GLWindow window = GLWindow.create(caps);
-
- window.setPosition(10, 10);
- window.setSize(800, 400);
- window.setTitle("GPU Text Newt Demo 02 - gvbaa4 gmsaa0");
-
- RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory());
- GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(rs, Region.VBAA_RENDERING_BIT, 4, blending, DEBUG, TRACE);
- // ((TextRenderer)textGLListener.getRenderer()).setCacheLimit(32);
- window.addGLEventListener(textGLListener);
- window.setVisible(true);
- // FPSAnimator animator = new FPSAnimator(60);
- final Animator animator = new Animator();
- animator.setUpdateFPSFrames(60, System.err);
- animator.add(window);
-
- window.addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent arg0) {
- if(arg0.getKeyCode() == KeyEvent.VK_F4) {
- window.destroy();
- }
- }
- });
- window.addWindowListener(new WindowAdapter() {
- public void windowDestroyed(WindowEvent e) {
- animator.stop();
- }
- });
-
- animator.start();
- }
-}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java
index a74fd407a..0bd4d45a4 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java
@@ -258,7 +258,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
pmv.glLoadIdentity();
pmv.glTranslatef(nearPlaneX0+(dx*nearPlaneSx), nearPlaneY0+(dy*nearPlaneSy), nearPlaneZ0);
renderer.updateMatrix(gl);
- System.err.printf("FontN: [%f %f] -> [%f %f]%n", dx, dy, nearPlaneX0+(dx*nearPlaneSx), nearPlaneY0+(dy*nearPlaneSy));
+ // System.err.printf("FontN: [%f %f] -> [%f %f]%n", dx, dy, nearPlaneX0+(dx*nearPlaneSx), nearPlaneY0+(dy*nearPlaneSy));
textRegionUtil.drawString3D(gl, font, nearPlaneS * pixelSizeFName, fontName, getSampleCount());
dx = 10f;
@@ -267,7 +267,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
if(null != headtext) {
pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmv.glLoadIdentity();
- System.err.printf("Head: [%f %f] -> [%f %f]%n", dx, dy, nearPlaneX0+(dx*nearPlaneSx), nearPlaneY0+(dy*nearPlaneSy));
+ // System.err.printf("Head: [%f %f] -> [%f %f]%n", dx, dy, nearPlaneX0+(dx*nearPlaneSx), nearPlaneY0+(dy*nearPlaneSy));
pmv.glTranslatef(nearPlaneX0+(dx*nearPlaneSx), nearPlaneY0+(dy*nearPlaneSy), nearPlaneZ0);
// pmv.glTranslatef(x0, y1, z0);
renderer.updateMatrix(gl);
@@ -279,7 +279,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmv.glLoadIdentity();
pmv.glTranslatef(nearPlaneX0+(dx*nearPlaneSx), nearPlaneY0+(dy*nearPlaneSy), nearPlaneZ0);
- System.err.printf("Bottom: [%f %f] -> [%f %f]%n", dx, dy, nearPlaneX0+(dx*nearPlaneSx), nearPlaneY0+(dy*nearPlaneSy));
+ // System.err.printf("Bottom: [%f %f] -> [%f %f]%n", dx, dy, nearPlaneX0+(dx*nearPlaneSx), nearPlaneY0+(dy*nearPlaneSy));
pmv.glTranslatef(getXTran(), getYTran(), getZTran());
pmv.glRotatef(getAngle(), 0, 1, 0);
renderer.updateMatrix(gl);
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java
index 00338e41a..f22a5c56c 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java
@@ -490,6 +490,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
}
renderer = RegionRenderer.create(rs, renderModes, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable);
+ // renderer = RegionRenderer.create(rs, renderModes, null, null);
gl.setSwapInterval(1);
gl.glEnable(GL2ES2.GL_DEPTH_TEST);
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java
new file mode 100644
index 000000000..c59d85824
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java
@@ -0,0 +1,90 @@
+package com.jogamp.opengl.test.junit.graph.demos;
+
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLProfile;
+
+import com.jogamp.graph.curve.Region;
+import com.jogamp.graph.curve.opengl.RenderState;
+import com.jogamp.graph.geom.SVertex;
+import com.jogamp.newt.event.WindowAdapter;
+import com.jogamp.newt.event.WindowEvent;
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.util.glsl.ShaderState;
+
+public class GPUUISceneNewtDemo {
+ static final boolean DEBUG = false;
+ static final boolean TRACE = false;
+
+ static int SceneMSAASamples = 0;
+ static boolean GraphVBAAMode = true;
+ static boolean GraphMSAAMode = false;
+
+ public static void main(String[] args) {
+ if( 0 != args.length ) {
+ SceneMSAASamples = 0;
+ GraphMSAAMode = false;
+ GraphVBAAMode = false;
+
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-smsaa")) {
+ i++;
+ SceneMSAASamples = MiscUtils.atoi(args[i], SceneMSAASamples);
+ } else if(args[i].equals("-gmsaa")) {
+ GraphMSAAMode = true;
+ GraphVBAAMode = false;
+ } else if(args[i].equals("-gvbaa")) {
+ i++;
+ GraphMSAAMode = false;
+ GraphVBAAMode = true;
+ }
+ }
+ }
+ System.err.println("Scene MSAA Samples "+SceneMSAASamples);
+ System.err.println("Graph MSAA Mode "+GraphMSAAMode);
+ System.err.println("Graph VBAA Mode "+GraphVBAAMode);
+
+ GLProfile glp = GLProfile.getGL2ES2();
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setAlphaBits(4);
+ if( SceneMSAASamples > 0 ) {
+ caps.setSampleBuffers(true);
+ caps.setNumSamples(SceneMSAASamples);
+ }
+ System.out.println("Requested: " + caps);
+
+ final int rmode;
+ if( GraphVBAAMode ) {
+ rmode = Region.VBAA_RENDERING_BIT;
+ } else if( GraphMSAAMode ) {
+ rmode = Region.MSAA_RENDERING_BIT;
+ } else {
+ rmode = 0;
+ }
+
+ final GLWindow window = GLWindow.create(caps);
+ window.setPosition(10, 10);
+ window.setSize(800, 400);
+ window.setTitle("GraphUI Newt Demo: graph["+Region.getRenderModeString(rmode)+"], msaa "+SceneMSAASamples);
+
+ final RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory());
+ GPUUISceneGLListener0A sceneGLListener = new GPUUISceneGLListener0A(rs, rmode, DEBUG, TRACE);
+
+ window.addGLEventListener(sceneGLListener);
+ sceneGLListener.attachInputListenerTo(window);
+
+ final Animator animator = new Animator();
+ animator.setUpdateFPSFrames(60, null); // System.err);
+ animator.add(window);
+
+ window.addWindowListener(new WindowAdapter() {
+ public void windowDestroyed(WindowEvent e) {
+ animator.stop();
+ }
+ });
+
+ window.setVisible(true);
+ animator.start();
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo01.java
deleted file mode 100644
index 127d30aae..000000000
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo01.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.jogamp.opengl.test.junit.graph.demos;
-
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLProfile;
-
-import com.jogamp.graph.curve.opengl.RenderState;
-import com.jogamp.graph.geom.SVertex;
-import com.jogamp.newt.event.WindowAdapter;
-import com.jogamp.newt.event.WindowEvent;
-import com.jogamp.newt.opengl.GLWindow;
-import com.jogamp.opengl.util.Animator;
-import com.jogamp.opengl.util.glsl.ShaderState;
-
-public class GPUUISceneNewtDemo01 {
- static final boolean DEBUG = false;
- static final boolean TRACE = false;
-
- public static void main(String[] args) {
- GLProfile glp = GLProfile.getGL2ES2();
- GLCapabilities caps = new GLCapabilities(glp);
- caps.setAlphaBits(4);
- caps.setSampleBuffers(true);
- caps.setNumSamples(4);
-
- final GLWindow window = GLWindow.create(caps);
- window.setPosition(10, 10);
- window.setSize(800, 400);
- window.setTitle("GraphUI Newt Demo");
-
- final RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory());
- GPUUISceneGLListener0A textGLListener = new GPUUISceneGLListener0A(rs, 0, DEBUG, TRACE);
- window.addGLEventListener(textGLListener);
- textGLListener.attachInputListenerTo(window);
-
- final Animator animator = new Animator();
- animator.setUpdateFPSFrames(60, null);//System.err);
- animator.add(window);
-
- window.addWindowListener(new WindowAdapter() {
- public void windowDestroyed(WindowEvent e) {
- animator.stop();
- }
- });
-
- window.setVisible(true);
- animator.start();
- }
-}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo02.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo02.java
deleted file mode 100644
index b09a73160..000000000
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo02.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.jogamp.opengl.test.junit.graph.demos;
-
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLProfile;
-
-import com.jogamp.graph.curve.Region;
-import com.jogamp.graph.curve.opengl.RenderState;
-import com.jogamp.graph.geom.SVertex;
-import com.jogamp.newt.event.WindowAdapter;
-import com.jogamp.newt.event.WindowEvent;
-import com.jogamp.newt.opengl.GLWindow;
-import com.jogamp.opengl.util.Animator;
-import com.jogamp.opengl.util.glsl.ShaderState;
-
-public class GPUUISceneNewtDemo02 {
- static final boolean DEBUG = false;
- static final boolean TRACE = false;
-
- public static void main(String[] args) {
- GLProfile glp = GLProfile.getGL2ES2();
- GLCapabilities caps = new GLCapabilities(glp);
- caps.setAlphaBits(4);
-
- final GLWindow window = GLWindow.create(caps);
- window.setPosition(10, 10);
- window.setSize(800, 400);
- window.setTitle("GraphUI Newt Demo");
-
- final RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory());
- GPUUISceneGLListener0A textGLListener = new GPUUISceneGLListener0A(rs, Region.VBAA_RENDERING_BIT, DEBUG, TRACE);
- window.addGLEventListener(textGLListener);
- textGLListener.attachInputListenerTo(window);
-
- final Animator animator = new Animator();
- animator.setUpdateFPSFrames(60, null); // System.err);
- animator.add(window);
-
- window.addWindowListener(new WindowAdapter() {
- public void windowDestroyed(WindowEvent e) {
- animator.stop();
- }
- });
-
- window.setVisible(true);
- animator.start();
- }
-}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java
index 19758539b..fb0604a44 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java
@@ -786,11 +786,11 @@ public class TestQuaternion01NOUI {
if( DEBUG )System.err.println("quat0 "+quat);
quat.rotateVector(vecHas, 0, UNIT_Z, 0);
if( DEBUG ) {
- System.err.println("xAxis "+Arrays.toString(xAxis)+", len "+VectorUtil.vec3Length(xAxis));
- System.err.println("yAxis "+Arrays.toString(yAxis)+", len "+VectorUtil.vec3Length(yAxis));
- System.err.println("zAxis "+Arrays.toString(zAxis)+", len "+VectorUtil.vec3Length(zAxis));
- System.err.println("exp0 "+Arrays.toString(direction)+", len "+VectorUtil.vec3Length(direction));
- System.err.println("has0 "+Arrays.toString(vecHas)+", len "+VectorUtil.vec3Length(vecHas));
+ System.err.println("xAxis "+Arrays.toString(xAxis)+", len "+VectorUtil.vec3Norm(xAxis));
+ System.err.println("yAxis "+Arrays.toString(yAxis)+", len "+VectorUtil.vec3Norm(yAxis));
+ System.err.println("zAxis "+Arrays.toString(zAxis)+", len "+VectorUtil.vec3Norm(zAxis));
+ System.err.println("exp0 "+Arrays.toString(direction)+", len "+VectorUtil.vec3Norm(direction));
+ System.err.println("has0 "+Arrays.toString(vecHas)+", len "+VectorUtil.vec3Norm(vecHas));
}
// Assert.assertEquals(0f, VectorUtil.distance(direction, quat.rotateVector(vecHas, 0, UNIT_Z, 0)), Quaternion.ALLOWED_DEVIANCE);
Assert.assertEquals(0f, VectorUtil.vec3Distance(direction, vecHas), Quaternion.ALLOWED_DEVIANCE);
@@ -801,11 +801,11 @@ public class TestQuaternion01NOUI {
if( DEBUG )System.err.println("quat0 "+quat);
quat.rotateVector(vecHas, 0, UNIT_Z, 0);
if( DEBUG ) {
- System.err.println("xAxis "+Arrays.toString(xAxis)+", len "+VectorUtil.vec3Length(xAxis));
- System.err.println("yAxis "+Arrays.toString(yAxis)+", len "+VectorUtil.vec3Length(yAxis));
- System.err.println("zAxis "+Arrays.toString(zAxis)+", len "+VectorUtil.vec3Length(zAxis));
- System.err.println("exp0 "+Arrays.toString(direction)+", len "+VectorUtil.vec3Length(direction));
- System.err.println("has0 "+Arrays.toString(vecHas)+", len "+VectorUtil.vec3Length(vecHas));
+ System.err.println("xAxis "+Arrays.toString(xAxis)+", len "+VectorUtil.vec3Norm(xAxis));
+ System.err.println("yAxis "+Arrays.toString(yAxis)+", len "+VectorUtil.vec3Norm(yAxis));
+ System.err.println("zAxis "+Arrays.toString(zAxis)+", len "+VectorUtil.vec3Norm(zAxis));
+ System.err.println("exp0 "+Arrays.toString(direction)+", len "+VectorUtil.vec3Norm(direction));
+ System.err.println("has0 "+Arrays.toString(vecHas)+", len "+VectorUtil.vec3Norm(vecHas));
}
// Assert.assertEquals(0f, VectorUtil.distance(direction, quat.rotateVector(vecHas, 0, UNIT_Z, 0)), Quaternion.ALLOWED_DEVIANCE);
Assert.assertEquals(0f, VectorUtil.vec3Distance(direction, vecHas), Quaternion.ALLOWED_DEVIANCE);