summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsrc/jogl/classes/com/jogamp/graph/curve/OutlineShape.java408
-rwxr-xr-xsrc/jogl/classes/com/jogamp/graph/curve/Region.java168
-rwxr-xr-xsrc/jogl/classes/com/jogamp/graph/curve/RegionFactory.java36
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/tess/CDTriangulator2D.java324
-rw-r--r--src/jogl/classes/com/jogamp/graph/font/Font.java34
-rw-r--r--src/jogl/classes/com/jogamp/graph/geom/AABBox.java470
-rw-r--r--src/jogl/classes/com/jogamp/graph/geom/Outline.java258
-rw-r--r--src/jogl/classes/com/jogamp/graph/geom/Triangle.java84
-rw-r--r--src/jogl/classes/com/jogamp/graph/geom/Vertex.java62
-rw-r--r--src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java278
-rwxr-xr-xsrc/jogl/classes/com/jogamp/graph/math/Quaternion.java668
-rwxr-xr-xsrc/jogl/classes/com/jogamp/graph/math/VectorUtil.java466
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java18
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/Locator.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java24
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java26
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java92
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java10
-rw-r--r--src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java2
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java6
-rwxr-xr-xsrc/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java56
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java210
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java368
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java252
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp148
-rw-r--r--src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java80
-rw-r--r--src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java160
-rw-r--r--src/jogl/classes/jogamp/graph/curve/tess/HEdge.java190
-rw-r--r--src/jogl/classes/jogamp/graph/curve/tess/Loop.java668
-rw-r--r--src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java230
-rw-r--r--src/jogl/classes/jogamp/graph/curve/text/GlyphString.java228
-rw-r--r--src/jogl/classes/jogamp/graph/font/JavaFontLoader.java4
-rw-r--r--src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java8
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java142
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java38
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java30
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java148
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java4
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java4
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java4
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java6
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java48
-rw-r--r--src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java38
-rw-r--r--src/jogl/classes/jogamp/graph/geom/plane/Path2D.java6
-rw-r--r--src/jogl/classes/jogamp/graph/math/plane/Crossing.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/README.txt110
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java52
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/ActiveRegion.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/GLUface.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/GLUmesh.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java50
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/GLUvertex.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java30
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java30
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java46
-rw-r--r--src/jogl/native/macosx/ContextUpdater.h8
-rw-r--r--src/jogl/native/macosx/ContextUpdater.m74
-rw-r--r--src/jogl/native/macosx/MacOSXWindowSystemInterface.m692
-rw-r--r--src/jogl/native/openmax/omx_tool.c12
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java2
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/util/Insets.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java2
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Bug427GLJPanelTest1.java6
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Issue326Test1.java20
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java14
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Issue344Base.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java176
-rwxr-xr-xsrc/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java184
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java116
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java24
-rwxr-xr-xsrc/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java12
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo02.java14
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java32
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java48
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java32
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/MSAATool.java66
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RIButton.java304
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIControl.java76
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java64
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java74
-rwxr-xr-xsrc/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java10
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TestAWTTextRendererUseVertexArrayBug464.java36
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererGLEventListener01.java36
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererTraceGL2Mock01.java140
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/TestGearsGLJPanelAWTBug450.java30
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode00NEWT.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java6
117 files changed, 4701 insertions, 4701 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
index 827717a..724380f 100755
--- a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
@@ -50,13 +50,13 @@ import com.jogamp.graph.curve.tess.CDTriangulator2D;
* <br><br>
* Example to creating an Outline Shape:
* <pre>
- addVertex(...)
- addVertex(...)
- addVertex(...)
- addEnptyOutline()
- addVertex(...)
- addVertex(...)
- addVertex(...)
+ addVertex(...)
+ addVertex(...)
+ addVertex(...)
+ addEnptyOutline()
+ addVertex(...)
+ addVertex(...)
+ addVertex(...)
* </pre>
*
* The above will create two outlines each with three vertices. By adding these two outlines to
@@ -72,10 +72,10 @@ import com.jogamp.graph.curve.tess.CDTriangulator2D;
*
* <br>Example: <br>
* <pre>
- addVertex(0,0, true);
- addVertex(0,1, false);
- addVertex(1,1, false);
- addVertex(1,0, true);
+ addVertex(0,0, true);
+ addVertex(0,1, false);
+ addVertex(1,1, false);
+ addVertex(1,0, true);
* </pre>
*
* The above snippet defines a cubic nurbs curve where (0,1 and 1,1)
@@ -83,8 +83,8 @@ import com.jogamp.graph.curve.tess.CDTriangulator2D;
*
* <i>Implementation Notes:</i><br>
* <ul>
- * <li> The first vertex of any outline belonging to the shape should be on-curve</li>
- * <li> Intersections between off-curved parts of the outline is not handled</li>
+ * <li> The first vertex of any outline belonging to the shape should be on-curve</li>
+ * <li> Intersections between off-curved parts of the outline is not handled</li>
* </ul>
*
* @see Outline
@@ -92,216 +92,216 @@ import com.jogamp.graph.curve.tess.CDTriangulator2D;
*/
public class OutlineShape {
- public static final int QUADRATIC_NURBS = 10;
- private final Vertex.Factory<? extends Vertex> vertexFactory;
+ public static final int QUADRATIC_NURBS = 10;
+ private final Vertex.Factory<? extends Vertex> vertexFactory;
- /** The list of {@link Outline}s that are part of this
- * outline shape.
- */
- private ArrayList<Outline> outlines = new ArrayList<Outline>(3);
+ /** The list of {@link Outline}s that are part of this
+ * outline shape.
+ */
+ private ArrayList<Outline> outlines = new ArrayList<Outline>(3);
- /** Create a new Outline based Shape
- */
- public OutlineShape(Vertex.Factory<? extends Vertex> factory) {
- vertexFactory = factory;
- outlines.add(new Outline());
- }
+ /** Create a new Outline based Shape
+ */
+ public OutlineShape(Vertex.Factory<? extends Vertex> factory) {
+ vertexFactory = factory;
+ outlines.add(new Outline());
+ }
- /** Returns the associated vertex factory of this outline shape
- * @return Vertex.Factory object
- */
- public final Vertex.Factory<? extends Vertex> vertexFactory() { return vertexFactory; }
+ /** Returns the associated vertex factory of this outline shape
+ * @return Vertex.Factory object
+ */
+ public final Vertex.Factory<? extends Vertex> vertexFactory() { return vertexFactory; }
- /** Add a new empty {@link Outline}
- * to the shape, this new outline will
- * be placed at the end of the outline list.
- *
- * After a call to this function all new vertices added
- * will belong to the new outline
- */
- public void addEmptyOutline(){
- outlines.add(new Outline());
- }
+ /** Add a new empty {@link Outline}
+ * to the shape, this new outline will
+ * be placed at the end of the outline list.
+ *
+ * After a call to this function all new vertices added
+ * will belong to the new outline
+ */
+ public void addEmptyOutline(){
+ outlines.add(new Outline());
+ }
- /** Adds an {@link Outline} to the OutlineShape object
- * if last outline of the shape is empty, it will replace
- * that last Outline with the new one. If outline is empty,
- * it will do nothing.
- * @param outline an Outline object
- */
- public void addOutline(Outline outline){
- if(outline.isEmpty()){
- return;
- }
- if(getLastOutline().isEmpty()){
- outlines.remove(getLastOutline());
- }
- outlines.add(outline);
- }
+ /** Adds an {@link Outline} to the OutlineShape object
+ * if last outline of the shape is empty, it will replace
+ * that last Outline with the new one. If outline is empty,
+ * it will do nothing.
+ * @param outline an Outline object
+ */
+ public void addOutline(Outline outline){
+ if(outline.isEmpty()){
+ return;
+ }
+ if(getLastOutline().isEmpty()){
+ outlines.remove(getLastOutline());
+ }
+ outlines.add(outline);
+ }
- /** Adds a vertex to the last open outline in the
- * shape.
- * @param v the vertex to be added to the OutlineShape
- */
- public final void addVertex(Vertex v){
- getLastOutline().addVertex(v);
- }
+ /** Adds a vertex to the last open outline in the
+ * shape.
+ * @param v the vertex to be added to the OutlineShape
+ */
+ public final void addVertex(Vertex v){
+ getLastOutline().addVertex(v);
+ }
- /** Add a 2D {@link Vertex} to the last outline by defining the coordniate attribute
- * of the vertex. The 2D vertex will be represented as Z=0.
- *
- * @param x the x coordinate
- * @param y the y coordniate
- * @param onCurve flag if this vertex is on the final curve or defines a curved region
- * of the shape around this vertex.
- */
- public final void addVertex(float x, float y, boolean onCurve) {
- getLastOutline().addVertex(vertexFactory, x, y, onCurve);
- }
+ /** Add a 2D {@link Vertex} to the last outline by defining the coordniate attribute
+ * of the vertex. The 2D vertex will be represented as Z=0.
+ *
+ * @param x the x coordinate
+ * @param y the y coordniate
+ * @param onCurve flag if this vertex is on the final curve or defines a curved region
+ * of the shape around this vertex.
+ */
+ public final void addVertex(float x, float y, boolean onCurve) {
+ getLastOutline().addVertex(vertexFactory, x, y, onCurve);
+ }
- /** Add a 3D {@link Vertex} to the last outline by defining the coordniate attribute
- * of the vertex.
- * @param x the x coordinate
- * @param y the y coordniate
- * @param z the z coordniate
- * @param onCurve flag if this vertex is on the final curve or defines a curved region
- * of the shape around this vertex.
- */
- public final void addVertex(float x, float y, float z, boolean onCurve) {
- getLastOutline().addVertex(vertexFactory, x, y, z, onCurve);
- }
+ /** Add a 3D {@link Vertex} to the last outline by defining the coordniate attribute
+ * of the vertex.
+ * @param x the x coordinate
+ * @param y the y coordniate
+ * @param z the z coordniate
+ * @param onCurve flag if this vertex is on the final curve or defines a curved region
+ * of the shape around this vertex.
+ */
+ public final void addVertex(float x, float y, float z, boolean onCurve) {
+ getLastOutline().addVertex(vertexFactory, x, y, z, onCurve);
+ }
- /** Add a vertex to the last outline by passing a float array and specifying the
- * offset and length in which. The attributes of the vertex are located.
- * The attributes should be continuous (stride = 0).
- * Attributes which value are not set (when length less than 3)
- * are set implicitly to zero.
- * @param coordsBuffer the coordinate array where the vertex attributes are to be picked from
- * @param offset the offset in the buffer to the x coordinate
- * @param length the number of attributes to pick from the buffer (maximum 3)
- * @param onCurve flag if this vertex is on the final curve or defines a curved region
- * of the shape around this vertex.
- */
- public final void addVertex(float[] coordsBuffer, int offset, int length, boolean onCurve) {
- getLastOutline().addVertex(vertexFactory, coordsBuffer, offset, length, onCurve);
- }
+ /** Add a vertex to the last outline by passing a float array and specifying the
+ * offset and length in which. The attributes of the vertex are located.
+ * The attributes should be continuous (stride = 0).
+ * Attributes which value are not set (when length less than 3)
+ * are set implicitly to zero.
+ * @param coordsBuffer the coordinate array where the vertex attributes are to be picked from
+ * @param offset the offset in the buffer to the x coordinate
+ * @param length the number of attributes to pick from the buffer (maximum 3)
+ * @param onCurve flag if this vertex is on the final curve or defines a curved region
+ * of the shape around this vertex.
+ */
+ public final void addVertex(float[] coordsBuffer, int offset, int length, boolean onCurve) {
+ getLastOutline().addVertex(vertexFactory, coordsBuffer, offset, length, onCurve);
+ }
- /** Closes the last outline in the shape
- * if last vertex is not equal to first vertex.
- * A new temp vertex is added at the end which
- * is equal to the first.
- */
- public void closeLastOutline(){
- getLastOutline().setClosed(true);
- }
+ /** Closes the last outline in the shape
+ * if last vertex is not equal to first vertex.
+ * A new temp vertex is added at the end which
+ * is equal to the first.
+ */
+ public void closeLastOutline(){
+ getLastOutline().setClosed(true);
+ }
- /** Get the last added outline to the list
- * of outlines that define the shape
- * @return the last outline
- */
- public final Outline getLastOutline(){
- return outlines.get(outlines.size()-1);
- }
- /** Make sure that the outlines represent
- * the specified destinationType, if not
- * transform outlines to destination type.
- * @param destinationType The curve type needed
- */
- public void transformOutlines(int destinationType){
- if(destinationType == QUADRATIC_NURBS){
- transformOutlinesQuadratic();
- }
- }
+ /** Get the last added outline to the list
+ * of outlines that define the shape
+ * @return the last outline
+ */
+ public final Outline getLastOutline(){
+ return outlines.get(outlines.size()-1);
+ }
+ /** Make sure that the outlines represent
+ * the specified destinationType, if not
+ * transform outlines to destination type.
+ * @param destinationType The curve type needed
+ */
+ public void transformOutlines(int destinationType){
+ if(destinationType == QUADRATIC_NURBS){
+ transformOutlinesQuadratic();
+ }
+ }
- private void transformOutlinesQuadratic(){
- ArrayList<Outline> newOutlines = new ArrayList<Outline>(3);
+ private void transformOutlinesQuadratic(){
+ ArrayList<Outline> newOutlines = new ArrayList<Outline>(3);
- /**loop over the outlines and make sure no
- * adj off-curve vertices
- */
- for(Outline outline:outlines){
- Outline newOutline = new Outline();
+ /**loop over the outlines and make sure no
+ * adj off-curve vertices
+ */
+ for(Outline outline:outlines){
+ Outline newOutline = new Outline();
- ArrayList<Vertex> vertices = outline.getVertices();
- int size =vertices.size()-1;
- for(int i=0;i<size;i++){
- Vertex currentVertex = vertices.get(i);
- Vertex nextVertex = vertices.get((i+1)%size);
- if(!(currentVertex.isOnCurve()) && !(nextVertex.isOnCurve())) {
- newOutline.addVertex(currentVertex);
+ ArrayList<Vertex> vertices = outline.getVertices();
+ int size =vertices.size()-1;
+ for(int i=0;i<size;i++){
+ Vertex currentVertex = vertices.get(i);
+ Vertex nextVertex = vertices.get((i+1)%size);
+ if(!(currentVertex.isOnCurve()) && !(nextVertex.isOnCurve())) {
+ newOutline.addVertex(currentVertex);
- float[] newCoords = VectorUtil.mid(currentVertex.getCoord(), nextVertex.getCoord());
- newOutline.addVertex(vertexFactory, newCoords, 0, 3, true);
- }
- else {
- newOutline.addVertex(currentVertex);
- }
- }
- newOutlines.add(newOutline);
- }
- outlines = newOutlines;
- }
+ float[] newCoords = VectorUtil.mid(currentVertex.getCoord(), nextVertex.getCoord());
+ newOutline.addVertex(vertexFactory, newCoords, 0, 3, true);
+ }
+ else {
+ newOutline.addVertex(currentVertex);
+ }
+ }
+ newOutlines.add(newOutline);
+ }
+ outlines = newOutlines;
+ }
- private void generateVertexIds(){
- int maxVertexId = 0;
- for(Outline outline:outlines){
- ArrayList<Vertex> vertices = outline.getVertices();
- for(Vertex vert:vertices){
- vert.setId(maxVertexId);
- maxVertexId++;
- }
- }
- }
+ private void generateVertexIds(){
+ int maxVertexId = 0;
+ for(Outline outline:outlines){
+ ArrayList<Vertex> vertices = outline.getVertices();
+ for(Vertex vert:vertices){
+ vert.setId(maxVertexId);
+ maxVertexId++;
+ }
+ }
+ }
- /** @return the list of vertices associated with the
- * {@code Outline} list of this object
- */
- public ArrayList<Vertex> getVertices(){
- ArrayList<Vertex> vertices = new ArrayList<Vertex>();
- for(Outline polyline:outlines){
- vertices.addAll(polyline.getVertices());
- }
- return vertices;
- }
+ /** @return the list of vertices associated with the
+ * {@code Outline} list of this object
+ */
+ public ArrayList<Vertex> getVertices(){
+ ArrayList<Vertex> vertices = new ArrayList<Vertex>();
+ for(Outline polyline:outlines){
+ vertices.addAll(polyline.getVertices());
+ }
+ return vertices;
+ }
- /** Triangulate the outline shape generating a list of triangles
- * @return an arraylist of triangles representing the filled region
- * which is produced by the combination of the outlines
- */
- public ArrayList<Triangle> triangulate(){
- return triangulate(0.5f);
- }
+ /** Triangulate the outline shape generating a list of triangles
+ * @return an arraylist of triangles representing the filled region
+ * which is produced by the combination of the outlines
+ */
+ public ArrayList<Triangle> triangulate(){
+ return triangulate(0.5f);
+ }
- /**Triangulate the {@link OutlineShape} generating a list of triangles
- * @param sharpness defines the curvature strength around the off-curve vertices.
- * defaults to 0.5f
- * @return an arraylist of triangles representing the filled region
- * which is produced by the combination of the outlines
- */
- public ArrayList<Triangle> triangulate(float sharpness){
- if(outlines.size() == 0){
- return null;
- }
- sortOutlines();
- generateVertexIds();
-
- CDTriangulator2D triangulator2d = new CDTriangulator2D(sharpness);
- for(int index = 0; index< outlines.size();index++){
- Outline outline = outlines.get(index);
- triangulator2d.addCurve(outline);
- }
-
- ArrayList<Triangle> triangles = triangulator2d.generateTriangulation();
- triangulator2d.reset();
+ /**Triangulate the {@link OutlineShape} generating a list of triangles
+ * @param sharpness defines the curvature strength around the off-curve vertices.
+ * defaults to 0.5f
+ * @return an arraylist of triangles representing the filled region
+ * which is produced by the combination of the outlines
+ */
+ public ArrayList<Triangle> triangulate(float sharpness){
+ if(outlines.size() == 0){
+ return null;
+ }
+ sortOutlines();
+ generateVertexIds();
+
+ CDTriangulator2D triangulator2d = new CDTriangulator2D(sharpness);
+ for(int index = 0; index< outlines.size();index++){
+ Outline outline = outlines.get(index);
+ triangulator2d.addCurve(outline);
+ }
+
+ ArrayList<Triangle> triangles = triangulator2d.generateTriangulation();
+ triangulator2d.reset();
- return triangles;
- }
+ return triangles;
+ }
- /** Sort the outlines from large
- * to small depending on the AABox
- */
- private void sortOutlines() {
- Collections.sort(outlines);
- Collections.reverse(outlines);
- }
+ /** Sort the outlines from large
+ * to small depending on the AABox
+ */
+ private void sortOutlines() {
+ Collections.sort(outlines);
+ Collections.reverse(outlines);
+ }
}
diff --git a/src/jogl/classes/com/jogamp/graph/curve/Region.java b/src/jogl/classes/com/jogamp/graph/curve/Region.java
index cc21af8..926ab54 100755
--- a/src/jogl/classes/com/jogamp/graph/curve/Region.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/Region.java
@@ -49,94 +49,94 @@ import com.jogamp.opengl.util.PMVMatrix;
public interface Region {
public static final boolean DEBUG = Debug.debug("graph.curve");
- /** The vertices index in an OGL object
- */
- public static int VERTEX_ATTR_IDX = 0;
- public static String VERTEX_ATTR_NAME = "v_position";
+ /** The vertices index in an OGL object
+ */
+ public static int VERTEX_ATTR_IDX = 0;
+ public static String VERTEX_ATTR_NAME = "v_position";
- /** The Texture Coord index in an OGL object
- */
- public static int TEXCOORD_ATTR_IDX = 1;
- public static String TEXCOORD_ATTR_NAME = "texCoord";
-
+ /** The Texture Coord index in an OGL object
+ */
+ public static int TEXCOORD_ATTR_IDX = 1;
+ public static String TEXCOORD_ATTR_NAME = "texCoord";
+
/** The color index in an OGL object
*/
public static int COLOR_ATTR_IDX = 2;
public static String COLOR_ATTR_NAME = "v_color";
- /** single pass rendering, fast, but AA might not be perfect */
- public static int SINGLE_PASS = 1;
-
- /** two pass rendering, slower and more resource hungry (FBO), but AA is perfect */
- public static int TWO_PASS = 2;
-
- /** Updates a graph region by updating the ogl related
- * objects for use in rendering. if called for the first time
- * it initialize the objects.
- */
- public void update();
-
- /** Renders the associated OGL objects specifying
- * current width/hight of window for multi pass rendering
- * of the region.
- * @param matrix current {@link PMVMatrix}.
- * @param vp_width current screen width
- * @param vp_height current screen height
- * @param width texture width for mp rendering
- *
- * @see update()
- */
- public void render(PMVMatrix matrix, int vp_width, int vp_height, int width);
-
- /** Adds a list of {@link Triangle} objects to the Region
- * These triangles are to be binded to OGL objects
- * on the next call to {@code update}
- * @param tris an arraylist of triangle objects
- *
- * @see update()
- */
- public void addTriangles(ArrayList<Triangle> tris);
-
- /** Get the current number of vertices associated
- * with this region. This number is not necessary equal to
- * the OGL binded number of vertices.
- * @return vertices count
- *
- * @see isDirty()
- */
- public int getNumVertices();
-
- /** Adds a list of {@link Vertex} objects to the Region
- * These vertices are to be binded to OGL objects
- * on the next call to {@code update}
- * @param verts an arraylist of vertex objects
- *
- * @see update()
- */
- public void addVertices(ArrayList<Vertex> verts);
-
- /** Check if this region is dirty. A region is marked dirty
- * when new Vertices, Triangles, and or Lines are added after a
- * call to update()
- * @return true if region is Dirty, false otherwise
- *
- * @see update();
- */
- public boolean isDirty();
-
- /** Delete and clean the associated OGL
- * objects
- */
- public void destroy();
-
- public AABBox getBounds();
-
- public boolean isFlipped();
-
- /** Set if the y coordinate of the region should be flipped
- * {@code y=-y} used mainly for fonts since they use opposite vertex
- * as origion
- * @param flipped flag if the coordinate is flipped defaults to false.
- */
- public void setFlipped(boolean flipped);
+ /** single pass rendering, fast, but AA might not be perfect */
+ public static int SINGLE_PASS = 1;
+
+ /** two pass rendering, slower and more resource hungry (FBO), but AA is perfect */
+ public static int TWO_PASS = 2;
+
+ /** Updates a graph region by updating the ogl related
+ * objects for use in rendering. if called for the first time
+ * it initialize the objects.
+ */
+ public void update();
+
+ /** Renders the associated OGL objects specifying
+ * current width/hight of window for multi pass rendering
+ * of the region.
+ * @param matrix current {@link PMVMatrix}.
+ * @param vp_width current screen width
+ * @param vp_height current screen height
+ * @param width texture width for mp rendering
+ *
+ * @see update()
+ */
+ public void render(PMVMatrix matrix, int vp_width, int vp_height, int width);
+
+ /** Adds a list of {@link Triangle} objects to the Region
+ * These triangles are to be binded to OGL objects
+ * on the next call to {@code update}
+ * @param tris an arraylist of triangle objects
+ *
+ * @see update()
+ */
+ public void addTriangles(ArrayList<Triangle> tris);
+
+ /** Get the current number of vertices associated
+ * with this region. This number is not necessary equal to
+ * the OGL binded number of vertices.
+ * @return vertices count
+ *
+ * @see isDirty()
+ */
+ public int getNumVertices();
+
+ /** Adds a list of {@link Vertex} objects to the Region
+ * These vertices are to be binded to OGL objects
+ * on the next call to {@code update}
+ * @param verts an arraylist of vertex objects
+ *
+ * @see update()
+ */
+ public void addVertices(ArrayList<Vertex> verts);
+
+ /** Check if this region is dirty. A region is marked dirty
+ * when new Vertices, Triangles, and or Lines are added after a
+ * call to update()
+ * @return true if region is Dirty, false otherwise
+ *
+ * @see update();
+ */
+ public boolean isDirty();
+
+ /** Delete and clean the associated OGL
+ * objects
+ */
+ public void destroy();
+
+ public AABBox getBounds();
+
+ public boolean isFlipped();
+
+ /** Set if the y coordinate of the region should be flipped
+ * {@code y=-y} used mainly for fonts since they use opposite vertex
+ * as origion
+ * @param flipped flag if the coordinate is flipped defaults to false.
+ */
+ public void setFlipped(boolean flipped);
}
diff --git a/src/jogl/classes/com/jogamp/graph/curve/RegionFactory.java b/src/jogl/classes/com/jogamp/graph/curve/RegionFactory.java
index d3b978b..91bbbd7 100755
--- a/src/jogl/classes/com/jogamp/graph/curve/RegionFactory.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/RegionFactory.java
@@ -41,22 +41,22 @@ import jogamp.graph.curve.opengl.VBORegion2PES2;
* @see Region
*/
public class RegionFactory {
-
- /**Create a Region based on the GLContext attached
- * @param context the current {@link GLContext}
- * @param st the {@link ShaderState} object
- * @param type can be one of Region.SINGLE_PASS or Region.TWO_PASS
- * @return region
- */
- public static Region create(GLContext context, ShaderState st, int type){
- if( !context.isGL2ES2() ) {
- throw new GLException("At least a GL2ES2 GL context is required. Given: " + context);
- }
- if( Region.TWO_PASS == type ){
- return new VBORegion2PES2(context, st);
- }
- else{
- return new VBORegionSPES2(context);
- }
- }
+
+ /**Create a Region based on the GLContext attached
+ * @param context the current {@link GLContext}
+ * @param st the {@link ShaderState} object
+ * @param type can be one of Region.SINGLE_PASS or Region.TWO_PASS
+ * @return region
+ */
+ public static Region create(GLContext context, ShaderState st, int type){
+ if( !context.isGL2ES2() ) {
+ throw new GLException("At least a GL2ES2 GL context is required. Given: " + context);
+ }
+ if( Region.TWO_PASS == type ){
+ return new VBORegion2PES2(context, st);
+ }
+ else{
+ return new VBORegionSPES2(context);
+ }
+ }
}
diff --git a/src/jogl/classes/com/jogamp/graph/curve/tess/CDTriangulator2D.java b/src/jogl/classes/com/jogamp/graph/curve/tess/CDTriangulator2D.java
index a2e4ca5..42eebf7 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/tess/CDTriangulator2D.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/tess/CDTriangulator2D.java
@@ -48,169 +48,169 @@ import jogamp.opengl.Debug;
*/
public class CDTriangulator2D {
- protected static final boolean DEBUG = Debug.debug("Triangulation");
-
- private float sharpness = 0.5f;
- private ArrayList<Loop> loops;
- private ArrayList<Vertex> vertices;
-
- private ArrayList<Triangle> triangles;
- private int maxTriID = 0;
+ protected static final boolean DEBUG = Debug.debug("Triangulation");
+
+ private float sharpness = 0.5f;
+ private ArrayList<Loop> loops;
+ private ArrayList<Vertex> vertices;
+
+ private ArrayList<Triangle> triangles;
+ private int maxTriID = 0;
-
- public CDTriangulator2D() {
- this(0.5f);
- }
-
- /** Constructor for a new Delaunay triangulator
- * @param curveSharpness the curvature around
- * the off-curve vertices
- */
- public CDTriangulator2D(float curveSharpness) {
- this.sharpness = curveSharpness;
- reset();
- }
-
- /** Reset the triangulation to initial state
- * Clearing cached data
- */
- public void reset() {
- maxTriID = 0;
- vertices = new ArrayList<Vertex>();
- triangles = new ArrayList<Triangle>(3);
- loops = new ArrayList<Loop>();
- }
-
- /** Add a curve to the list of profiles provided
- * @param polyline a bounding {@link Outline}
- */
- public void addCurve(Outline polyline){
- Loop loop = null;
-
- if(!loops.isEmpty()){
- loop = getContainerLoop(polyline);
- }
-
- if(loop == null) {
- GraphOutline outline = new GraphOutline(polyline);
- GraphOutline innerPoly = extractBoundaryTriangles(outline, false);
- vertices.addAll(polyline.getVertices());
- loop = new Loop(innerPoly, VectorUtil.CCW);
- loops.add(loop);
- }
- else {
- GraphOutline outline = new GraphOutline(polyline);
- GraphOutline innerPoly = extractBoundaryTriangles(outline, true);
- vertices.addAll(innerPoly.getPoints());
- loop.addConstraintCurve(innerPoly);
- }
- }
-
- /** Generate the triangulation of the provided
- * List of {@link Outline}s
- */
- public ArrayList<Triangle> generateTriangulation(){
- for(int i=0;i<loops.size();i++) {
- Loop loop = loops.get(i);
- int numTries = 0;
- int size = loop.computeLoopSize();
- while(!loop.isSimplex()){
- Triangle tri = null;
- if(numTries > size){
- tri = loop.cut(false);
- }
- else{
- tri = loop.cut(true);
- }
- numTries++;
+
+ public CDTriangulator2D() {
+ this(0.5f);
+ }
+
+ /** Constructor for a new Delaunay triangulator
+ * @param curveSharpness the curvature around
+ * the off-curve vertices
+ */
+ public CDTriangulator2D(float curveSharpness) {
+ this.sharpness = curveSharpness;
+ reset();
+ }
+
+ /** Reset the triangulation to initial state
+ * Clearing cached data
+ */
+ public void reset() {
+ maxTriID = 0;
+ vertices = new ArrayList<Vertex>();
+ triangles = new ArrayList<Triangle>(3);
+ loops = new ArrayList<Loop>();
+ }
+
+ /** Add a curve to the list of profiles provided
+ * @param polyline a bounding {@link Outline}
+ */
+ public void addCurve(Outline polyline){
+ Loop loop = null;
+
+ if(!loops.isEmpty()){
+ loop = getContainerLoop(polyline);
+ }
+
+ if(loop == null) {
+ GraphOutline outline = new GraphOutline(polyline);
+ GraphOutline innerPoly = extractBoundaryTriangles(outline, false);
+ vertices.addAll(polyline.getVertices());
+ loop = new Loop(innerPoly, VectorUtil.CCW);
+ loops.add(loop);
+ }
+ else {
+ GraphOutline outline = new GraphOutline(polyline);
+ GraphOutline innerPoly = extractBoundaryTriangles(outline, true);
+ vertices.addAll(innerPoly.getPoints());
+ loop.addConstraintCurve(innerPoly);
+ }
+ }
+
+ /** Generate the triangulation of the provided
+ * List of {@link Outline}s
+ */
+ public ArrayList<Triangle> generateTriangulation(){
+ for(int i=0;i<loops.size();i++) {
+ Loop loop = loops.get(i);
+ int numTries = 0;
+ int size = loop.computeLoopSize();
+ while(!loop.isSimplex()){
+ Triangle tri = null;
+ if(numTries > size){
+ tri = loop.cut(false);
+ }
+ else{
+ tri = loop.cut(true);
+ }
+ numTries++;
- if(tri != null) {
- numTries = 0;
- size--;
- tri.setId(maxTriID++);
- triangles.add(tri);
- if(DEBUG){
- System.err.println(tri);
- }
- }
- if(numTries > size*2){
- if(DEBUG){
- System.err.println("Triangulation not complete!");
- }
- break;
- }
- }
- Triangle tri = loop.cut(true);
- if(tri != null)
- triangles.add(tri);
- }
- return triangles;
- }
+ if(tri != null) {
+ numTries = 0;
+ size--;
+ tri.setId(maxTriID++);
+ triangles.add(tri);
+ if(DEBUG){
+ System.err.println(tri);
+ }
+ }
+ if(numTries > size*2){
+ if(DEBUG){
+ System.err.println("Triangulation not complete!");
+ }
+ break;
+ }
+ }
+ Triangle tri = loop.cut(true);
+ if(tri != null)
+ triangles.add(tri);
+ }
+ return triangles;
+ }
- private GraphOutline extractBoundaryTriangles(GraphOutline outline, boolean hole){
- GraphOutline innerOutline = new GraphOutline();
- ArrayList<GraphVertex> outVertices = outline.getGraphPoint();
- int size = outVertices.size();
- for(int i=0; i < size; i++) {
- GraphVertex currentVertex = outVertices.get(i);
- GraphVertex gv0 = outVertices.get((i+size-1)%size);
- GraphVertex gv2 = outVertices.get((i+1)%size);
- GraphVertex gv1 = currentVertex;
-
- if(!currentVertex.getPoint().isOnCurve()) {
- Vertex v0 = gv0.getPoint().clone();
- Vertex v2 = gv2.getPoint().clone();
- Vertex v1 = gv1.getPoint().clone();
-
- gv0.setBoundaryContained(true);
- gv1.setBoundaryContained(true);
- gv2.setBoundaryContained(true);
-
- Triangle t= null;
- boolean holeLike = false;
- if(VectorUtil.ccw(v0,v1,v2)){
- t = new Triangle(v0, v1, v2);
- }
- else {
- holeLike = true;
- t = new Triangle(v2, v1, v0);
- }
- t.setId(maxTriID++);
- triangles.add(t);
- if(DEBUG){
- 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);
- }
- else {
- v0.setTexCoord(0, 0.1f);
- v2.setTexCoord(1, 0.1f);
- v1.setTexCoord(0.5f, sharpness+0.1f);
- }
- }
- else {
- if(!gv2.getPoint().isOnCurve() || !gv0.getPoint().isOnCurve()){
- currentVertex.setBoundaryContained(true);
- }
- innerOutline.addVertex(currentVertex);
- }
- }
- return innerOutline;
- }
-
- private Loop getContainerLoop(Outline polyline){
- ArrayList<Vertex> vertices = polyline.getVertices();
- for(Vertex vert: vertices){
- for (Loop loop:loops){
- if(loop.checkInside(vert)){
- return loop;
- }
- }
- }
- return null;
- }
+ private GraphOutline extractBoundaryTriangles(GraphOutline outline, boolean hole){
+ GraphOutline innerOutline = new GraphOutline();
+ ArrayList<GraphVertex> outVertices = outline.getGraphPoint();
+ int size = outVertices.size();
+ for(int i=0; i < size; i++) {
+ GraphVertex currentVertex = outVertices.get(i);
+ GraphVertex gv0 = outVertices.get((i+size-1)%size);
+ GraphVertex gv2 = outVertices.get((i+1)%size);
+ GraphVertex gv1 = currentVertex;
+
+ if(!currentVertex.getPoint().isOnCurve()) {
+ Vertex v0 = gv0.getPoint().clone();
+ Vertex v2 = gv2.getPoint().clone();
+ Vertex v1 = gv1.getPoint().clone();
+
+ gv0.setBoundaryContained(true);
+ gv1.setBoundaryContained(true);
+ gv2.setBoundaryContained(true);
+
+ Triangle t= null;
+ boolean holeLike = false;
+ if(VectorUtil.ccw(v0,v1,v2)){
+ t = new Triangle(v0, v1, v2);
+ }
+ else {
+ holeLike = true;
+ t = new Triangle(v2, v1, v0);
+ }
+ t.setId(maxTriID++);
+ triangles.add(t);
+ if(DEBUG){
+ 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);
+ }
+ else {
+ v0.setTexCoord(0, 0.1f);
+ v2.setTexCoord(1, 0.1f);
+ v1.setTexCoord(0.5f, sharpness+0.1f);
+ }
+ }
+ else {
+ if(!gv2.getPoint().isOnCurve() || !gv0.getPoint().isOnCurve()){
+ currentVertex.setBoundaryContained(true);
+ }
+ innerOutline.addVertex(currentVertex);
+ }
+ }
+ return innerOutline;
+ }
+
+ private Loop getContainerLoop(Outline polyline){
+ ArrayList<Vertex> vertices = polyline.getVertices();
+ for(Vertex vert: vertices){
+ for (Loop loop:loops){
+ if(loop.checkInside(vert)){
+ return loop;
+ }
+ }
+ }
+ return null;
+ }
}
diff --git a/src/jogl/classes/com/jogamp/graph/font/Font.java b/src/jogl/classes/com/jogamp/graph/font/Font.java
index d8c30c6..1010d4f 100644
--- a/src/jogl/classes/com/jogamp/graph/font/Font.java
+++ b/src/jogl/classes/com/jogamp/graph/font/Font.java
@@ -52,27 +52,27 @@ public interface Font {
public static final int NAME_DESIGNER = 9;
- /**
- * Metrics for font
- *
- * Depending on the font's direction, horizontal or vertical,
- * the following tables shall be used:
- *
- * Vertical http://developer.apple.com/fonts/TTRefMan/RM06/Chap6vhea.html
+ /**
+ * Metrics for font
+ *
+ * Depending on the font's direction, horizontal or vertical,
+ * the following tables shall be used:
+ *
+ * Vertical http://developer.apple.com/fonts/TTRefMan/RM06/Chap6vhea.html
* Horizontal http://developer.apple.com/fonts/TTRefMan/RM06/Chap6hhea.html
- */
+ */
public interface Metrics {
- float getAscent(float pixelSize);
- float getDescent(float pixelSize);
- float getLineGap(float pixelSize);
- float getMaxExtend(float pixelSize);
- float getScale(float pixelSize);
- AABBox getBBox(float pixelSize);
+ float getAscent(float pixelSize);
+ float getDescent(float pixelSize);
+ float getLineGap(float pixelSize);
+ float getMaxExtend(float pixelSize);
+ float getScale(float pixelSize);
+ AABBox getBBox(float pixelSize);
}
- /**
- * Glyph for font
- */
+ /**
+ * Glyph for font
+ */
public interface Glyph {
public Font getFont();
public char getSymbol();
diff --git a/src/jogl/classes/com/jogamp/graph/geom/AABBox.java b/src/jogl/classes/com/jogamp/graph/geom/AABBox.java
index 17a805b..8a604ec 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/AABBox.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/AABBox.java
@@ -36,176 +36,176 @@ import com.jogamp.graph.math.VectorUtil;
*
*/
public class AABBox {
- private float[] low = {Float.MAX_VALUE,Float.MAX_VALUE,Float.MAX_VALUE};
- private float[] high = {-1*Float.MAX_VALUE,-1*Float.MAX_VALUE,-1*Float.MAX_VALUE};
- private float[] center = new float[3];
+ private float[] low = {Float.MAX_VALUE,Float.MAX_VALUE,Float.MAX_VALUE};
+ private float[] high = {-1*Float.MAX_VALUE,-1*Float.MAX_VALUE,-1*Float.MAX_VALUE};
+ private float[] center = new float[3];
- /** Create a Axis Aligned bounding box (AABBox)
- * where the low and and high MAX float Values.
- */
- public AABBox() {}
+ /** Create a Axis Aligned bounding box (AABBox)
+ * where the low and and high MAX float Values.
+ */
+ public AABBox() {}
- /** Create an AABBox specifying the coordinates
- * of the low and high
- * @param lx min x-coordinate
- * @param ly min y-coordnate
- * @param lz min z-coordinate
- * @param hx max x-coordinate
- * @param hy max y-coordinate
- * @param hz max z-coordinate
- */
- public AABBox(float lx, float ly, float lz,
- float hx, float hy, float hz)
- {
- resize(lx, ly, lz);
- resize(hx, hy, hz);
+ /** Create an AABBox specifying the coordinates
+ * of the low and high
+ * @param lx min x-coordinate
+ * @param ly min y-coordnate
+ * @param lz min z-coordinate
+ * @param hx max x-coordinate
+ * @param hy max y-coordinate
+ * @param hz max z-coordinate
+ */
+ public AABBox(float lx, float ly, float lz,
+ float hx, float hy, float hz)
+ {
+ resize(lx, ly, lz);
+ resize(hx, hy, hz);
- computeCenter();
- }
-
- /** Create a AABBox defining the low and high
- * @param low min xyz-coordinates
- * @param high max xyz-coordinates
- */
- public AABBox(float[] low, float[] high)
- {
- resize(low[0],low[1],low[2]);
- resize(high[0],high[1],high[2]);
+ computeCenter();
+ }
+
+ /** Create a AABBox defining the low and high
+ * @param low min xyz-coordinates
+ * @param high max xyz-coordinates
+ */
+ public AABBox(float[] low, float[] high)
+ {
+ resize(low[0],low[1],low[2]);
+ resize(high[0],high[1],high[2]);
- computeCenter();
- }
-
- /** Get the max xyz-coordinates
- * @return a float array containing the max xyz coordinates
- */
- public float[] getHigh()
- {
- return high;
- }
-
- private void setHigh(float hx, float hy, float hz)
- {
- this.high[0] = hx;
- this.high[1] = hy;
- this.high[2] = hz;
- }
-
- /** Get the min xyz-coordinates
- * @return a float array containing the min xyz coordinates
- */
- public float[] getLow()
- {
- return low;
- }
-
- private void setLow(float lx, float ly, float lz)
- {
- this.low[0] = lx;
- this.low[1] = ly;
- this.low[2] = lz;
- }
+ computeCenter();
+ }
+
+ /** Get the max xyz-coordinates
+ * @return a float array containing the max xyz coordinates
+ */
+ public float[] getHigh()
+ {
+ return high;
+ }
+
+ private void setHigh(float hx, float hy, float hz)
+ {
+ this.high[0] = hx;
+ this.high[1] = hy;
+ this.high[2] = hz;
+ }
+
+ /** Get the min xyz-coordinates
+ * @return a float array containing the min xyz coordinates
+ */
+ public float[] getLow()
+ {
+ return low;
+ }
+
+ private void setLow(float lx, float ly, float lz)
+ {
+ this.low[0] = lx;
+ this.low[1] = ly;
+ this.low[2] = lz;
+ }
- /** Resize the AABBox to encapsulate another AABox
- * @param newBox AABBox to be encapsulated in
- */
- public void resize(AABBox newBox)
- {
- float[] newLow = newBox.getLow();
- float[] newHigh = newBox.getHigh();
+ /** Resize the AABBox to encapsulate another AABox
+ * @param newBox AABBox to be encapsulated in
+ */
+ public void resize(AABBox newBox)
+ {
+ float[] newLow = newBox.getLow();
+ float[] newHigh = newBox.getHigh();
- /** test low */
- if (newLow[0] < low[0])
- low[0] = newLow[0];
- if (newLow[1] < low[1])
- low[1] = newLow[1];
- if (newLow[2] < low[2])
- low[2] = newLow[2];
+ /** test low */
+ if (newLow[0] < low[0])
+ low[0] = newLow[0];
+ if (newLow[1] < low[1])
+ low[1] = newLow[1];
+ if (newLow[2] < low[2])
+ low[2] = newLow[2];
- /** test high */
- if (newHigh[0] > high[0])
- high[0] = newHigh[0];
- if (newHigh[1] > high[1])
- high[1] = newHigh[1];
- if (newHigh[2] > high[2])
- high[2] = newHigh[2];
+ /** test high */
+ if (newHigh[0] > high[0])
+ high[0] = newHigh[0];
+ if (newHigh[1] > high[1])
+ high[1] = newHigh[1];
+ if (newHigh[2] > high[2])
+ high[2] = newHigh[2];
- computeCenter();
- }
+ computeCenter();
+ }
- private void computeCenter()
- {
- center[0] = (high[0] + low[0])/2;
- center[1] = (high[1] + low[1])/2;
- center[2] = (high[2] + low[2])/2;
- }
+ private void computeCenter()
+ {
+ center[0] = (high[0] + low[0])/2;
+ center[1] = (high[1] + low[1])/2;
+ center[2] = (high[2] + low[2])/2;
+ }
- /** Resize the AABBox to encapsulate the passed
- * xyz-coordinates.
- * @param x x-axis coordinate value
- * @param y y-axis coordinate value
- * @param z z-axis coordinate value
- */
- public void resize(float x, float y, float z)
- {
- /** test low */
- if (x < low[0])
- low[0] = x;
- if (y < low[1])
- low[1] = y;
- if (z < low[2])
- low[2] = z;
+ /** Resize the AABBox to encapsulate the passed
+ * xyz-coordinates.
+ * @param x x-axis coordinate value
+ * @param y y-axis coordinate value
+ * @param z z-axis coordinate value
+ */
+ public void resize(float x, float y, float z)
+ {
+ /** test low */
+ if (x < low[0])
+ low[0] = x;
+ if (y < low[1])
+ low[1] = y;
+ if (z < low[2])
+ low[2] = z;
- /** test high */
- if (x > high[0])
- high[0] = x;
- if (y > high[1])
- high[1] = y;
- if (z > high[2])
- high[2] = z;
-
- computeCenter();
- }
+ /** test high */
+ if (x > high[0])
+ high[0] = x;
+ if (y > high[1])
+ high[1] = y;
+ if (z > high[2])
+ high[2] = z;
+
+ computeCenter();
+ }
- /** Check if the x & y coordinates are bounded/contained
- * by this AABBox
- * @param x x-axis coordinate value
- * @param y y-axis coordinate value
- * @return true if x belong to (low.x, high.x) and
- * y belong to (low.y, high.y)
- */
- public boolean contains(float x, float y){
- if(x<low[0] || x>high[0]){
- return false;
- }
- if(y<low[1]|| y>high[1]){
- return false;
- }
- return true;
- }
-
- /** Check if the xyz coordinates are bounded/contained
- * by this AABBox.
- * @param x x-axis coordinate value
- * @param y y-axis coordinate value
- * @param z z-axis coordinate value
- * @return true if x belong to (low.x, high.x) and
- * y belong to (low.y, high.y) and z belong to (low.z, high.z)
- */
- public boolean contains(float x, float y, float z){
- if(x<low[0] || x>high[0]){
- return false;
- }
- if(y<low[1]|| y>high[1]){
- return false;
- }
- if(z<low[2] || z>high[2]){
- return false;
- }
- return true;
- }
-
+ /** Check if the x & y coordinates are bounded/contained
+ * by this AABBox
+ * @param x x-axis coordinate value
+ * @param y y-axis coordinate value
+ * @return true if x belong to (low.x, high.x) and
+ * y belong to (low.y, high.y)
+ */
+ public boolean contains(float x, float y){
+ if(x<low[0] || x>high[0]){
+ return false;
+ }
+ if(y<low[1]|| y>high[1]){
+ return false;
+ }
+ return true;
+ }
+
+ /** Check if the xyz coordinates are bounded/contained
+ * by this AABBox.
+ * @param x x-axis coordinate value
+ * @param y y-axis coordinate value
+ * @param z z-axis coordinate value
+ * @return true if x belong to (low.x, high.x) and
+ * y belong to (low.y, high.y) and z belong to (low.z, high.z)
+ */
+ public boolean contains(float x, float y, float z){
+ if(x<low[0] || x>high[0]){
+ return false;
+ }
+ if(y<low[1]|| y>high[1]){
+ return false;
+ }
+ if(z<low[2] || z>high[2]){
+ return false;
+ }
+ return true;
+ }
+
/** Check if there is a common region between this AABBox and the passed
- * 2D region irrespective of z range
+ * 2D region irrespective of z range
* @param x lower left x-coord
* @param y lower left y-coord
* @param w width
@@ -213,87 +213,87 @@ public class AABBox {
* @return true if this AABBox might have a common region with this 2D region
*/
public boolean intersects(float x, float y, float w, float h) {
- if (w <= 0 || h <= 0) {
- return false;
- }
-
- final float _w = getWidth();
- final float _h = getHeight();
- if (_w <= 0 || _h <= 0) {
- return false;
- }
-
- final float x0 = getMinX();
- final float y0 = getMinY();
- return (x + w > x0 &&
- y + h > y0 &&
- x < x0 + _w &&
- y < y0 + _h);
+ if (w <= 0 || h <= 0) {
+ return false;
+ }
+
+ final float _w = getWidth();
+ final float _h = getHeight();
+ if (_w <= 0 || _h <= 0) {
+ return false;
+ }
+
+ final float x0 = getMinX();
+ final float y0 = getMinY();
+ return (x + w > x0 &&
+ y + h > y0 &&
+ x < x0 + _w &&
+ y < y0 + _h);
}
-
- /** Get the size of the Box where the size is represented by the
- * length of the vector between low and high.
- * @return a float representing the size of the AABBox
- */
- public float getSize(){
- return VectorUtil.computeLength(low, high);
- }
+
+ /** Get the size of the Box where the size is represented by the
+ * length of the vector between low and high.
+ * @return a float representing the size of the AABBox
+ */
+ public float getSize(){
+ return VectorUtil.computeLength(low, high);
+ }
- /**Get the Center of the AABBox
- * @return the xyz-coordinates of the center of the AABBox
- */
- public float[] getCenter() {
- return center;
- }
+ /**Get the Center of the AABBox
+ * @return the xyz-coordinates of the center of the AABBox
+ */
+ public float[] getCenter() {
+ return center;
+ }
- /** Scale the AABBox by a constant
- * @param size a constant float value
- */
- public void scale(float size) {
- float[] diffH = new float[3];
- diffH[0] = high[0] - center[0];
- diffH[1] = high[1] - center[1];
- diffH[2] = high[2] - center[2];
-
- diffH = VectorUtil.scale(diffH, size);
-
- float[] diffL = new float[3];
- diffL[0] = low[0] - center[0];
- diffL[1] = low[1] - center[1];
- diffL[2] = low[2] - center[2];
-
- diffL = VectorUtil.scale(diffL, size);
-
- high = VectorUtil.vectorAdd(center, diffH);
- low = VectorUtil.vectorAdd(center, diffL);
- }
+ /** Scale the AABBox by a constant
+ * @param size a constant float value
+ */
+ public void scale(float size) {
+ float[] diffH = new float[3];
+ diffH[0] = high[0] - center[0];
+ diffH[1] = high[1] - center[1];
+ diffH[2] = high[2] - center[2];
+
+ diffH = VectorUtil.scale(diffH, size);
+
+ float[] diffL = new float[3];
+ diffL[0] = low[0] - center[0];
+ diffL[1] = low[1] - center[1];
+ diffL[2] = low[2] - center[2];
+
+ diffL = VectorUtil.scale(diffL, size);
+
+ high = VectorUtil.vectorAdd(center, diffH);
+ low = VectorUtil.vectorAdd(center, diffL);
+ }
- public float getMinX() {
- return low[0];
- }
-
- public float getMinY() {
- return low[1];
- }
-
- public float getWidth(){
- return high[0] - low[0];
- }
-
- public float getHeight() {
- return high[1] - low[1];
- }
-
- public float getDepth() {
- return high[2] - low[2];
- }
- public AABBox clone(){
- return new AABBox(this.low, this.high);
- }
-
- public String toString() {
- return "[ "+low[0]+"/"+low[1]+"/"+low[1]+" .. "+high[0]+"/"+high[0]+"/"+high[0]+", ctr "+
- center[0]+"/"+center[1]+"/"+center[1]+" ]";
- }
+ public float getMinX() {
+ return low[0];
+ }
+
+ public float getMinY() {
+ return low[1];
+ }
+
+ public float getWidth(){
+ return high[0] - low[0];
+ }
+
+ public float getHeight() {
+ return high[1] - low[1];
+ }
+
+ public float getDepth() {
+ return high[2] - low[2];
+ }
+ public AABBox clone(){
+ return new AABBox(this.low, this.high);
+ }
+
+ public String toString() {
+ return "[ "+low[0]+"/"+low[1]+"/"+low[1]+" .. "+high[0]+"/"+high[0]+"/"+high[0]+", ctr "+
+ center[0]+"/"+center[1]+"/"+center[1]+" ]";
+ }
}
diff --git a/src/jogl/classes/com/jogamp/graph/geom/Outline.java b/src/jogl/classes/com/jogamp/graph/geom/Outline.java
index a805adf..315be00 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/Outline.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/Outline.java
@@ -44,133 +44,133 @@ import com.jogamp.graph.math.VectorUtil;
* @see OutlineShape, Region
*/
public class Outline implements Comparable<Outline> {
-
- private ArrayList<Vertex> vertices = new ArrayList<Vertex>(3);
- private boolean closed = false;
- private AABBox box = new AABBox();
-
- /**Create an outline defined by control vertices.
- * An outline can contain off Curve vertices which define curved
- * regions in the outline.
- */
- public Outline(){
-
- }
-
- /** Add a vertex to the outline. The {@link Vertex} is added at the
- * end of the outline loop/strip.
- * @param vertex Vertex to be added
- */
- public final void addVertex(Vertex vertex) {
- vertices.add(vertex);
- box.resize(vertex.getX(), vertex.getY(), vertex.getZ());
- }
-
- /** Add a {@link Vertex} by specifying its 2D attributes to the outline.
- * The {@link Vertex} is added at the
- * end of the outline loop/strip.
- * @param factory a {@link Factory} to get the required Vertex impl
- * @param x the x coordinate
- * @param y the y coordinate
- * @param onCurve flag if this vertex is on the final curve or defines a curved region
- * of the shape around this vertex.
- */
- public final void addVertex(Vertex.Factory<? extends Vertex> factory, float x, float y, boolean onCurve) {
- addVertex(factory, x, y, 0f, onCurve);
- }
-
- /** Add a {@link Vertex} by specifying its 3D attributes to the outline.
- * The {@link Vertex} is added at the
- * end of the outline loop/strip.
- * @param factory a {@link Factory} to get the required Vertex impl
- * @param x the x coordinate
- * @param y the y coordinate
- * @param z the z coordinate
- * @param onCurve flag if this vertex is on the final curve or defines a curved region
- * of the shape around this vertex.
- */
- public final void addVertex(Vertex.Factory<? extends Vertex> factory, float x, float y, float z, boolean onCurve) {
- Vertex v = factory.create(x, y, z);
- v.setOnCurve(onCurve);
- addVertex(v);
- }
-
- /** Add a vertex to the outline by passing a float array and specifying the
- * offset and length in which. The attributes of the vertex are located.
- * The attributes should be continuous (stride = 0).
- * Attributes which value are not set (when length less than 3)
- * are set implicitly to zero.
- * @param factory a {@link Factory} to get the required Vertex impl
- * @param coordsBuffer the coordinate array where the vertex attributes are to be picked from
- * @param offset the offset in the buffer to the x coordinate
- * @param length the number of attributes to pick from the buffer (maximum 3)
- * @param onCurve flag if this vertex is on the final curve or defines a curved region
- * of the shape around this vertex.
- */
- public final void addVertex(Vertex.Factory<? extends Vertex> factory, float[] coordsBuffer, int offset, int length, boolean onCurve) {
- Vertex v = factory.create(coordsBuffer, offset, length);
- v.setOnCurve(onCurve);
- addVertex(v);
- }
-
- public Vertex getVertex(int index){
- return vertices.get(index);
- }
-
- public boolean isEmpty(){
- return (vertices.size() == 0);
- }
- public Vertex getLastVertex(){
- if(isEmpty()){
- return null;
- }
- return vertices.get(vertices.size()-1);
- }
-
- public ArrayList<Vertex> getVertices() {
- return vertices;
- }
- public void setVertices(ArrayList<Vertex> vertices) {
- this.vertices = vertices;
- }
- public AABBox getBox() {
- return box;
- }
- public boolean isClosed() {
- return closed;
- }
-
- /** define if this outline is closed or not.
- * if set to closed, checks if the last vertex is
- * equal to the first vertex. If not Equal adds a
- * vertex at the end to the list.
- * @param closed
- */
- public void setClosed(boolean closed) {
- this.closed = closed;
- if(closed){
- Vertex first = vertices.get(0);
- Vertex last = getLastVertex();
- if(!VectorUtil.checkEquality(first.getCoord(), last.getCoord())){
- Vertex v = first.clone();
- vertices.add(v);
- }
- }
- }
-
- /** Compare two outlines with Bounding Box area
- * as criteria.
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- public int compareTo(Outline outline) {
- float size = box.getSize();
- float newSize = outline.getBox().getSize();
- if(size < newSize){
- return -1;
- }
- else if(size > newSize){
- return 1;
- }
- return 0;
- }
+
+ private ArrayList<Vertex> vertices = new ArrayList<Vertex>(3);
+ private boolean closed = false;
+ private AABBox box = new AABBox();
+
+ /**Create an outline defined by control vertices.
+ * An outline can contain off Curve vertices which define curved
+ * regions in the outline.
+ */
+ public Outline(){
+
+ }
+
+ /** Add a vertex to the outline. The {@link Vertex} is added at the
+ * end of the outline loop/strip.
+ * @param vertex Vertex to be added
+ */
+ public final void addVertex(Vertex vertex) {
+ vertices.add(vertex);
+ box.resize(vertex.getX(), vertex.getY(), vertex.getZ());
+ }
+
+ /** Add a {@link Vertex} by specifying its 2D attributes to the outline.
+ * The {@link Vertex} is added at the
+ * end of the outline loop/strip.
+ * @param factory a {@link Factory} to get the required Vertex impl
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @param onCurve flag if this vertex is on the final curve or defines a curved region
+ * of the shape around this vertex.
+ */
+ public final void addVertex(Vertex.Factory<? extends Vertex> factory, float x, float y, boolean onCurve) {
+ addVertex(factory, x, y, 0f, onCurve);
+ }
+
+ /** Add a {@link Vertex} by specifying its 3D attributes to the outline.
+ * The {@link Vertex} is added at the
+ * end of the outline loop/strip.
+ * @param factory a {@link Factory} to get the required Vertex impl
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @param z the z coordinate
+ * @param onCurve flag if this vertex is on the final curve or defines a curved region
+ * of the shape around this vertex.
+ */
+ public final void addVertex(Vertex.Factory<? extends Vertex> factory, float x, float y, float z, boolean onCurve) {
+ Vertex v = factory.create(x, y, z);
+ v.setOnCurve(onCurve);
+ addVertex(v);
+ }
+
+ /** Add a vertex to the outline by passing a float array and specifying the
+ * offset and length in which. The attributes of the vertex are located.
+ * The attributes should be continuous (stride = 0).
+ * Attributes which value are not set (when length less than 3)
+ * are set implicitly to zero.
+ * @param factory a {@link Factory} to get the required Vertex impl
+ * @param coordsBuffer the coordinate array where the vertex attributes are to be picked from
+ * @param offset the offset in the buffer to the x coordinate
+ * @param length the number of attributes to pick from the buffer (maximum 3)
+ * @param onCurve flag if this vertex is on the final curve or defines a curved region
+ * of the shape around this vertex.
+ */
+ public final void addVertex(Vertex.Factory<? extends Vertex> factory, float[] coordsBuffer, int offset, int length, boolean onCurve) {
+ Vertex v = factory.create(coordsBuffer, offset, length);
+ v.setOnCurve(onCurve);
+ addVertex(v);
+ }
+
+ public Vertex getVertex(int index){
+ return vertices.get(index);
+ }
+
+ public boolean isEmpty(){
+ return (vertices.size() == 0);
+ }
+ public Vertex getLastVertex(){
+ if(isEmpty()){
+ return null;
+ }
+ return vertices.get(vertices.size()-1);
+ }
+
+ public ArrayList<Vertex> getVertices() {
+ return vertices;
+ }
+ public void setVertices(ArrayList<Vertex> vertices) {
+ this.vertices = vertices;
+ }
+ public AABBox getBox() {
+ return box;
+ }
+ public boolean isClosed() {
+ return closed;
+ }
+
+ /** define if this outline is closed or not.
+ * if set to closed, checks if the last vertex is
+ * equal to the first vertex. If not Equal adds a
+ * vertex at the end to the list.
+ * @param closed
+ */
+ public void setClosed(boolean closed) {
+ this.closed = closed;
+ if(closed){
+ Vertex first = vertices.get(0);
+ Vertex last = getLastVertex();
+ if(!VectorUtil.checkEquality(first.getCoord(), last.getCoord())){
+ Vertex v = first.clone();
+ vertices.add(v);
+ }
+ }
+ }
+
+ /** Compare two outlines with Bounding Box area
+ * as criteria.
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ public int compareTo(Outline outline) {
+ float size = box.getSize();
+ float newSize = outline.getBox().getSize();
+ if(size < newSize){
+ return -1;
+ }
+ else if(size > newSize){
+ return 1;
+ }
+ return 0;
+ }
}
diff --git a/src/jogl/classes/com/jogamp/graph/geom/Triangle.java b/src/jogl/classes/com/jogamp/graph/geom/Triangle.java
index d13e8dd..fb34de2 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/Triangle.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/Triangle.java
@@ -28,52 +28,52 @@
package com.jogamp.graph.geom;
public class Triangle {
- private int id = Integer.MAX_VALUE;
- final private Vertex[] vertices;
- private boolean[] boundaryEdges = new boolean[3];
- private boolean[] boundaryVertices = null;
+ private int id = Integer.MAX_VALUE;
+ final private Vertex[] vertices;
+ private boolean[] boundaryEdges = new boolean[3];
+ private boolean[] boundaryVertices = null;
- public Triangle(Vertex ... v123){
- vertices = v123;
- }
+ public Triangle(Vertex ... v123){
+ vertices = v123;
+ }
- public int getId() {
- return id;
- }
+ public int getId() {
+ return id;
+ }
- public void setId(int id) {
- this.id = id;
- }
+ public void setId(int id) {
+ this.id = id;
+ }
- public Vertex[] getVertices() {
- return vertices;
- }
-
- public boolean isEdgesBoundary() {
- return boundaryEdges[0] || boundaryEdges[1] || boundaryEdges[2];
- }
-
- public boolean isVerticesBoundary() {
- return boundaryVertices[0] || boundaryVertices[1] || boundaryVertices[2];
- }
+ public Vertex[] getVertices() {
+ return vertices;
+ }
+
+ public boolean isEdgesBoundary() {
+ return boundaryEdges[0] || boundaryEdges[1] || boundaryEdges[2];
+ }
+
+ public boolean isVerticesBoundary() {
+ return boundaryVertices[0] || boundaryVertices[1] || boundaryVertices[2];
+ }
- public void setEdgesBoundary(boolean[] boundary) {
- this.boundaryEdges = boundary;
- }
-
- public boolean[] getEdgeBoundary() {
- return boundaryEdges;
- }
-
- public boolean[] getVerticesBoundary() {
- return boundaryVertices;
- }
+ public void setEdgesBoundary(boolean[] boundary) {
+ this.boundaryEdges = boundary;
+ }
+
+ public boolean[] getEdgeBoundary() {
+ return boundaryEdges;
+ }
+
+ public boolean[] getVerticesBoundary() {
+ return boundaryVertices;
+ }
- public void setVerticesBoundary(boolean[] boundaryVertices) {
- this.boundaryVertices = boundaryVertices;
- }
-
- public String toString() {
- return "Tri ID: " + id + "\n" + vertices[0] + "\n" + vertices[1] + "\n" + vertices[2];
- }
+ public void setVerticesBoundary(boolean[] boundaryVertices) {
+ this.boundaryVertices = boundaryVertices;
+ }
+
+ public String toString() {
+ return "Tri ID: " + id + "\n" + vertices[0] + "\n" + vertices[1] + "\n" + vertices[2];
+ }
}
diff --git a/src/jogl/classes/com/jogamp/graph/geom/Vertex.java b/src/jogl/classes/com/jogamp/graph/geom/Vertex.java
index 0e4e5e8..859add9 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/Vertex.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/Vertex.java
@@ -32,49 +32,49 @@ package com.jogamp.graph.geom;
*/
public interface Vertex extends Comparable<Vertex>, Cloneable {
- public static interface Factory <T extends Vertex> {
- T create();
+ public static interface Factory <T extends Vertex> {
+ T create();
- T create(float x, float y);
+ T create(float x, float y);
- T create(float x, float y, float z);
+ T create(float x, float y, float z);
- T create(float[] coordsBuffer, int offset, int length);
- }
-
- void setCoord(float x, float y);
+ T create(float[] coordsBuffer, int offset, int length);
+ }
+
+ void setCoord(float x, float y);
- void setCoord(float x, float y, float z);
+ void setCoord(float x, float y, float z);
- void setCoord(float[] coordsBuffer, int offset, int length);
-
- float[] getCoord();
+ void setCoord(float[] coordsBuffer, int offset, int length);
+
+ float[] getCoord();
- void setX(float x);
+ void setX(float x);
- void setY(float y);
+ void setY(float y);
- void setZ(float z);
+ void setZ(float z);
- float getX();
+ float getX();
- float getY();
+ float getY();
- float getZ();
+ float getZ();
- boolean isOnCurve();
+ boolean isOnCurve();
- void setOnCurve(boolean onCurve);
+ void setOnCurve(boolean onCurve);
- int getId();
-
- void setId(int id);
-
- int compareTo(Vertex p);
-
- float[] getTexCoord();
-
- void setTexCoord(float s, float t);
-
- Vertex clone();
+ int getId();
+
+ void setId(int id);
+
+ int compareTo(Vertex p);
+
+ float[] getTexCoord();
+
+ void setTexCoord(float s, float t);
+
+ Vertex clone();
}
diff --git a/src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java b/src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java
index 681067e..6241d60 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java
@@ -36,143 +36,143 @@ import com.jogamp.graph.math.VectorUtil;
*
*/
public class SVertex implements Vertex {
- private int id = Integer.MAX_VALUE;
- protected float[] coord = new float[3];
- protected boolean onCurve = true;
- private float[] texCoord = new float[2];
-
- static final Factory factory = new Factory();
-
- public static Factory factory() { return factory; }
-
- public static class Factory implements Vertex.Factory<SVertex> {
- @Override
- public SVertex create() {
- return new SVertex();
- }
-
- @Override
- public SVertex create(float x, float y) {
- return new SVertex(x, y);
- }
-
- @Override
- public SVertex create(float x, float y, float z) {
- return new SVertex(x, y, z);
- }
-
- @Override
- public SVertex create(float[] coordsBuffer, int offset, int length) {
- return new SVertex(coordsBuffer, offset, length);
- }
- }
-
- public SVertex() {
- }
-
- public SVertex(float x, float y) {
- setCoord(x, y);
- }
- public SVertex(float x, float y, float z) {
- setCoord(x, y, z);
- }
- public SVertex(float[] coordsBuffer, int offset, int length) {
- setCoord(coordsBuffer, offset, length);
- }
-
- public void setCoord(float x, float y) {
- this.coord[0] = x;
- this.coord[1] = y;
- this.coord[2] = 0f;
- }
-
- public void setCoord(float x, float y, float z) {
- this.coord[0] = x;
- this.coord[1] = y;
- this.coord[2] = z;
- }
-
- public void setCoord(float[] coordsBuffer, int offset, int length) {
- if(length > coordsBuffer.length - offset) {
- throw new IndexOutOfBoundsException("coordsBuffer too small: "+coordsBuffer.length+" - "+offset+" < "+length);
- }
- if(length > 3) {
- throw new IndexOutOfBoundsException("length too big: "+length+" > "+3);
- }
- int i=0;
- while(i<length) {
- this.coord[i++] = coordsBuffer[offset++];
- }
- }
-
- public float[] getCoord() {
- return coord;
- }
-
- public void setX(float x) {
- this.coord[0] = x;
- }
-
- public void setY(float y) {
- this.coord[1] = y;
- }
-
- public void setZ(float z) {
- this.coord[2] = z;
- }
-
- public float getX() {
- return this.coord[0];
- }
-
- public float getY() {
- return this.coord[1];
- }
-
- public float getZ() {
- return this.coord[2];
- }
-
- public boolean isOnCurve() {
- return onCurve;
- }
-
- public void setOnCurve(boolean onCurve) {
- this.onCurve = onCurve;
- }
-
- public int getId(){
- return id;
- }
-
- public void setId(int id){
- this.id = id;
- }
-
- public int compareTo(Vertex p) {
- if(VectorUtil.checkEquality(coord, p.getCoord())) {
- return 0;
- }
- return -1;
- }
-
- public float[] getTexCoord() {
- return texCoord;
- }
-
- public void setTexCoord(float s, float t) {
- this.texCoord[0] = s;
- this.texCoord[1] = t;
- }
-
- public SVertex clone(){
- SVertex v = new SVertex(this.coord, 0, 3);
- v.setOnCurve(this.onCurve);
- return v;
- }
-
- public String toString() {
- return "[ID: " + id + " X: " + coord[0]
- + " Y: " + coord[1] + " Z: " + coord[2] + "]";
- }
+ private int id = Integer.MAX_VALUE;
+ protected float[] coord = new float[3];
+ protected boolean onCurve = true;
+ private float[] texCoord = new float[2];
+
+ static final Factory factory = new Factory();
+
+ public static Factory factory() { return factory; }
+
+ public static class Factory implements Vertex.Factory<SVertex> {
+ @Override
+ public SVertex create() {
+ return new SVertex();
+ }
+
+ @Override
+ public SVertex create(float x, float y) {
+ return new SVertex(x, y);
+ }
+
+ @Override
+ public SVertex create(float x, float y, float z) {
+ return new SVertex(x, y, z);
+ }
+
+ @Override
+ public SVertex create(float[] coordsBuffer, int offset, int length) {
+ return new SVertex(coordsBuffer, offset, length);
+ }
+ }
+
+ public SVertex() {
+ }
+
+ public SVertex(float x, float y) {
+ setCoord(x, y);
+ }
+ public SVertex(float x, float y, float z) {
+ setCoord(x, y, z);
+ }
+ public SVertex(float[] coordsBuffer, int offset, int length) {
+ setCoord(coordsBuffer, offset, length);
+ }
+
+ public void setCoord(float x, float y) {
+ this.coord[0] = x;
+ this.coord[1] = y;
+ this.coord[2] = 0f;
+ }
+
+ public void setCoord(float x, float y, float z) {
+ this.coord[0] = x;
+ this.coord[1] = y;
+ this.coord[2] = z;
+ }
+
+ public void setCoord(float[] coordsBuffer, int offset, int length) {
+ if(length > coordsBuffer.length - offset) {
+ throw new IndexOutOfBoundsException("coordsBuffer too small: "+coordsBuffer.length+" - "+offset+" < "+length);
+ }
+ if(length > 3) {
+ throw new IndexOutOfBoundsException("length too big: "+length+" > "+3);
+ }
+ int i=0;
+ while(i<length) {
+ this.coord[i++] = coordsBuffer[offset++];
+ }
+ }
+
+ public float[] getCoord() {
+ return coord;
+ }
+
+ public void setX(float x) {
+ this.coord[0] = x;
+ }
+
+ public void setY(float y) {
+ this.coord[1] = y;
+ }
+
+ public void setZ(float z) {
+ this.coord[2] = z;
+ }
+
+ public float getX() {
+ return this.coord[0];
+ }
+
+ public float getY() {
+ return this.coord[1];
+ }
+
+ public float getZ() {
+ return this.coord[2];
+ }
+
+ public boolean isOnCurve() {
+ return onCurve;
+ }
+
+ public void setOnCurve(boolean onCurve) {
+ this.onCurve = onCurve;
+ }
+
+ public int getId(){
+ return id;
+ }
+
+ public void setId(int id){
+ this.id = id;
+ }
+
+ public int compareTo(Vertex p) {
+ if(VectorUtil.checkEquality(coord, p.getCoord())) {
+ return 0;
+ }
+ return -1;
+ }
+
+ public float[] getTexCoord() {
+ return texCoord;
+ }
+
+ public void setTexCoord(float s, float t) {
+ this.texCoord[0] = s;
+ this.texCoord[1] = t;
+ }
+
+ public SVertex clone(){
+ SVertex v = new SVertex(this.coord, 0, 3);
+ v.setOnCurve(this.onCurve);
+ return v;
+ }
+
+ public String toString() {
+ return "[ID: " + id + " X: " + coord[0]
+ + " Y: " + coord[1] + " Z: " + coord[2] + "]";
+ }
}
diff --git a/src/jogl/classes/com/jogamp/graph/math/Quaternion.java b/src/jogl/classes/com/jogamp/graph/math/Quaternion.java
index b77a5fa..38638dc 100755
--- a/src/jogl/classes/com/jogamp/graph/math/Quaternion.java
+++ b/src/jogl/classes/com/jogamp/graph/math/Quaternion.java
@@ -30,353 +30,353 @@ package com.jogamp.graph.math;
import jogamp.graph.math.MathFloat;
public class Quaternion {
- protected float x,y,z,w;
+ protected float x,y,z,w;
- public Quaternion(){
+ public Quaternion(){
- }
-
- public Quaternion(float x, float y, float z, float w) {
- this.x = x;
- this.y = y;
- this.z = z;
- this.w = w;
- }
-
- /** Constructor to create a rotation based quaternion from two vectors
- * @param vector1
- * @param vector2
- */
- public Quaternion(float[] vector1, float[] vector2)
- {
- float theta = (float)MathFloat.acos(dot(vector1, vector2));
- float[] cross = cross(vector1,vector2);
- cross = normalizeVec(cross);
+ }
+
+ public Quaternion(float x, float y, float z, float w) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.w = w;
+ }
+
+ /** Constructor to create a rotation based quaternion from two vectors
+ * @param vector1
+ * @param vector2
+ */
+ public Quaternion(float[] vector1, float[] vector2)
+ {
+ float theta = (float)MathFloat.acos(dot(vector1, vector2));
+ float[] cross = cross(vector1,vector2);
+ cross = normalizeVec(cross);
- this.x = (float)MathFloat.sin(theta/2)*cross[0];
- this.y = (float)MathFloat.sin(theta/2)*cross[1];
- this.z = (float)MathFloat.sin(theta/2)*cross[2];
- this.w = (float)MathFloat.cos(theta/2);
- this.normalize();
- }
-
- /** Transform the rotational quaternion to axis based rotation angles
- * @return new float[4] with ,theta,Rx,Ry,Rz
- */
- public float[] toAxis()
- {
- float[] vec = new float[4];
- float scale = (float)MathFloat.sqrt(x * x + y * y + z * z);
- vec[0] =(float) MathFloat.acos(w) * 2.0f;
- vec[1] = x / scale;
- vec[2] = y / scale;
- vec[3] = z / scale;
- return vec;
- }
-
- /** Normalize a vector
- * @param vector input vector
- * @return normalized vector
- */
- private float[] normalizeVec(float[] vector)
- {
- float[] newVector = new float[3];
+ this.x = (float)MathFloat.sin(theta/2)*cross[0];
+ this.y = (float)MathFloat.sin(theta/2)*cross[1];
+ this.z = (float)MathFloat.sin(theta/2)*cross[2];
+ this.w = (float)MathFloat.cos(theta/2);
+ this.normalize();
+ }
+
+ /** Transform the rotational quaternion to axis based rotation angles
+ * @return new float[4] with ,theta,Rx,Ry,Rz
+ */
+ public float[] toAxis()
+ {
+ float[] vec = new float[4];
+ float scale = (float)MathFloat.sqrt(x * x + y * y + z * z);
+ vec[0] =(float) MathFloat.acos(w) * 2.0f;
+ vec[1] = x / scale;
+ vec[2] = y / scale;
+ vec[3] = z / scale;
+ return vec;
+ }
+
+ /** Normalize a vector
+ * @param vector input vector
+ * @return normalized vector
+ */
+ private float[] normalizeVec(float[] vector)
+ {
+ float[] newVector = new float[3];
- float d = MathFloat.sqrt(vector[0]*vector[0] + vector[1]*vector[1] + vector[2]*vector[2]);
- if(d> 0.0f)
- {
- newVector[0] = vector[0]/d;
- newVector[1] = vector[1]/d;
- newVector[2] = vector[2]/d;
- }
- return newVector;
- }
- /** compute the dot product of two points
- * @param vec1 vector 1
- * @param vec2 vector 2
- * @return the dot product as float
- */
- private float dot(float[] vec1, float[] vec2)
- {
- return (vec1[0]*vec2[0] + vec1[1]*vec2[1] + vec1[2]*vec2[2]);
- }
- /** cross product vec1 x vec2
- * @param vec1 vector 1
- * @param vec2 vecttor 2
- * @return the resulting vector
- */
- private float[] cross(float[] vec1, float[] vec2)
- {
- float[] out = new float[3];
+ float d = MathFloat.sqrt(vector[0]*vector[0] + vector[1]*vector[1] + vector[2]*vector[2]);
+ if(d> 0.0f)
+ {
+ newVector[0] = vector[0]/d;
+ newVector[1] = vector[1]/d;
+ newVector[2] = vector[2]/d;
+ }
+ return newVector;
+ }
+ /** compute the dot product of two points
+ * @param vec1 vector 1
+ * @param vec2 vector 2
+ * @return the dot product as float
+ */
+ private float dot(float[] vec1, float[] vec2)
+ {
+ return (vec1[0]*vec2[0] + vec1[1]*vec2[1] + vec1[2]*vec2[2]);
+ }
+ /** cross product vec1 x vec2
+ * @param vec1 vector 1
+ * @param vec2 vecttor 2
+ * @return the resulting vector
+ */
+ private float[] cross(float[] vec1, float[] vec2)
+ {
+ float[] out = new float[3];
- out[0] = vec2[2]*vec1[1] - vec2[1]*vec1[2];
- out[1] = vec2[0]*vec1[2] - vec2[2]*vec1[0];
- out[2] = vec2[1]*vec1[0] - vec2[0]*vec1[1];
+ out[0] = vec2[2]*vec1[1] - vec2[1]*vec1[2];
+ out[1] = vec2[0]*vec1[2] - vec2[2]*vec1[0];
+ out[2] = vec2[1]*vec1[0] - vec2[0]*vec1[1];
- return out;
- }
- public float getW() {
- return w;
- }
- public void setW(float w) {
- this.w = w;
- }
- public float getX() {
- return x;
- }
- public void setX(float x) {
- this.x = x;
- }
- public float getY() {
- return y;
- }
- public void setY(float y) {
- this.y = y;
- }
- public float getZ() {
- return z;
- }
- public void setZ(float z) {
- this.z = z;
- }
+ return out;
+ }
+ public float getW() {
+ return w;
+ }
+ public void setW(float w) {
+ this.w = w;
+ }
+ public float getX() {
+ return x;
+ }
+ public void setX(float x) {
+ this.x = x;
+ }
+ public float getY() {
+ return y;
+ }
+ public void setY(float y) {
+ this.y = y;
+ }
+ public float getZ() {
+ return z;
+ }
+ public void setZ(float z) {
+ this.z = z;
+ }
- /** Add a quaternion
- * @param q quaternion
- */
- public void add(Quaternion q)
- {
- x+=q.x;
- y+=q.y;
- z+=q.z;
- }
-
- /** Subtract a quaternion
- * @param q quaternion
- */
- public void subtract(Quaternion q)
- {
- x-=q.x;
- y-=q.y;
- z-=q.z;
- }
-
- /** Divide a quaternion by a constant
- * @param n a float to divide by
- */
- public void divide(float n)
- {
- x/=n;
- y/=n;
- z/=n;
- }
-
- /** Multiply this quaternion by
- * the param quaternion
- * @param q a quaternion to multiply with
- */
- public void mult(Quaternion q)
- {
- float w1 = w*q.w - (x*q.x + y*q.y + z*q.z);
+ /** Add a quaternion
+ * @param q quaternion
+ */
+ public void add(Quaternion q)
+ {
+ x+=q.x;
+ y+=q.y;
+ z+=q.z;
+ }
+
+ /** Subtract a quaternion
+ * @param q quaternion
+ */
+ public void subtract(Quaternion q)
+ {
+ x-=q.x;
+ y-=q.y;
+ z-=q.z;
+ }
+
+ /** Divide a quaternion by a constant
+ * @param n a float to divide by
+ */
+ public void divide(float n)
+ {
+ x/=n;
+ y/=n;
+ z/=n;
+ }
+
+ /** Multiply this quaternion by
+ * the param quaternion
+ * @param q a quaternion to multiply with
+ */
+ public void mult(Quaternion q)
+ {
+ float w1 = w*q.w - (x*q.x + y*q.y + z*q.z);
- float x1 = w*q.z + q.w*z + y*q.z - z*q.y;
- float y1 = w*q.x + q.w*x + z*q.x - x*q.z;
- float z1 = w*q.y + q.w*y + x*q.y - y*q.x;
+ float x1 = w*q.z + q.w*z + y*q.z - z*q.y;
+ float y1 = w*q.x + q.w*x + z*q.x - x*q.z;
+ float z1 = w*q.y + q.w*y + x*q.y - y*q.x;
- w = w1;
- x = x1;
- y = y1;
- z = z1;
- }
-
- /** Multiply a quaternion by a constant
- * @param n a float constant
- */
- public void mult(float n)
- {
- x*=n;
- y*=n;
- z*=n;
- }
-
- /** Normalize a quaternion required if
- * to be used as a rotational quaternion
- */
- public void normalize()
- {
- float norme = (float)MathFloat.sqrt(w*w + x*x + y*y + z*z);
- if (norme == 0.0f)
- {
- w = 1.0f;
- x = y = z = 0.0f;
- }
- else
- {
- float recip = 1.0f/norme;
+ w = w1;
+ x = x1;
+ y = y1;
+ z = z1;
+ }
+
+ /** Multiply a quaternion by a constant
+ * @param n a float constant
+ */
+ public void mult(float n)
+ {
+ x*=n;
+ y*=n;
+ z*=n;
+ }
+
+ /** Normalize a quaternion required if
+ * to be used as a rotational quaternion
+ */
+ public void normalize()
+ {
+ float norme = (float)MathFloat.sqrt(w*w + x*x + y*y + z*z);
+ if (norme == 0.0f)
+ {
+ w = 1.0f;
+ x = y = z = 0.0f;
+ }
+ else
+ {
+ float recip = 1.0f/norme;
- w *= recip;
- x *= recip;
- y *= recip;
- z *= recip;
- }
- }
-
- /** Invert the quaternion If rotational,
- * will produce a the inverse rotation
- */
- public void inverse()
- {
- float norm = w*w + x*x + y*y + z*z;
+ w *= recip;
+ x *= recip;
+ y *= recip;
+ z *= recip;
+ }
+ }
+
+ /** Invert the quaternion If rotational,
+ * will produce a the inverse rotation
+ */
+ public void inverse()
+ {
+ float norm = w*w + x*x + y*y + z*z;
- float recip = 1.0f/norm;
+ float recip = 1.0f/norm;
- w *= recip;
- x = -1*x*recip;
- y = -1*y*recip;
- z = -1*z*recip;
- }
-
- /** Transform this quaternion to a
- * 4x4 column matrix representing the rotation
- * @return new float[16] column matrix 4x4
- */
- public float[] toMatrix()
- {
- float[] matrix = new float[16];
- matrix[0] = 1.0f - 2*y*y - 2*z*z;
- matrix[1] = 2*x*y + 2*w*z;
- matrix[2] = 2*x*z - 2*w*y;
- matrix[3] = 0;
+ w *= recip;
+ x = -1*x*recip;
+ y = -1*y*recip;
+ z = -1*z*recip;
+ }
+
+ /** Transform this quaternion to a
+ * 4x4 column matrix representing the rotation
+ * @return new float[16] column matrix 4x4
+ */
+ public float[] toMatrix()
+ {
+ float[] matrix = new float[16];
+ matrix[0] = 1.0f - 2*y*y - 2*z*z;
+ matrix[1] = 2*x*y + 2*w*z;
+ matrix[2] = 2*x*z - 2*w*y;
+ matrix[3] = 0;
- matrix[4] = 2*x*y - 2*w*z;
- matrix[5] = 1.0f - 2*x*x - 2*z*z;
- matrix[6] = 2*y*z + 2*w*x;
- matrix[7] = 0;
+ matrix[4] = 2*x*y - 2*w*z;
+ matrix[5] = 1.0f - 2*x*x - 2*z*z;
+ matrix[6] = 2*y*z + 2*w*x;
+ matrix[7] = 0;
- matrix[8] = 2*x*z + 2*w*y;
- matrix[9] = 2*y*z - 2*w*x;
- matrix[10] = 1.0f - 2*x*x - 2*y*y;
- matrix[11] = 0;
+ matrix[8] = 2*x*z + 2*w*y;
+ matrix[9] = 2*y*z - 2*w*x;
+ matrix[10] = 1.0f - 2*x*x - 2*y*y;
+ matrix[11] = 0;
- matrix[12] = 0;
- matrix[13] = 0;
- matrix[14] = 0;
- matrix[15] = 1;
- return matrix;
- }
-
- /** Set this quaternion from a Sphereical interpolation
- * of two param quaternion, used mostly for rotational animation
- * @param a initial quaternion
- * @param b target quaternion
- * @param t float between 0 and 1 representing interp.
- */
- public void slerp(Quaternion a,Quaternion b, float t)
- {
- float omega, cosom, sinom, sclp, sclq;
- cosom = a.x*b.x + a.y*b.y + a.z*b.z + a.w*b.w;
- if ((1.0f+cosom) > MathFloat.E) {
- if ((1.0f-cosom) > MathFloat.E) {
- omega = (float)MathFloat.acos(cosom);
- sinom = (float)MathFloat.sin(omega);
- sclp = (float)MathFloat.sin((1.0f-t)*omega) / sinom;
- sclq = (float)MathFloat.sin(t*omega) / sinom;
- }
- else {
- sclp = 1.0f - t;
- sclq = t;
- }
- x = sclp*a.x + sclq*b.x;
- y = sclp*a.y + sclq*b.y;
- z = sclp*a.z + sclq*b.z;
- w = sclp*a.w + sclq*b.w;
- }
- else {
- x =-a.y;
- y = a.x;
- z =-a.w;
- w = a.z;
- sclp = MathFloat.sin((1.0f-t) * MathFloat.PI * 0.5f);
- sclq = MathFloat.sin(t * MathFloat.PI * 0.5f);
- x = sclp*a.x + sclq*b.x;
- y = sclp*a.y + sclq*b.y;
- z = sclp*a.z + sclq*b.z;
- }
- }
-
- /** Check if this quaternion is empty, ie (0,0,0,1)
- * @return true if empty, false otherwise
- */
- public boolean isEmpty()
- {
- if (w==1 && x==0 && y==0 && z==0)
- return true;
- return false;
- }
-
- /** Check if this quaternion represents an identity
- * matrix, for rotation.
- * @return true if it is an identity rep., false otherwise
- */
- public boolean isIdentity()
- {
- if (w==0 && x==0 && y==0 && z==0)
- return true;
- return false;
- }
-
- /** compute the quaternion from a 3x3 column matrix
- * @param m 3x3 column matrix
- */
- public void setFromMatrix(float[] m) {
- float T= m[0] + m[4] + m[8] + 1;
- if (T>0){
- float S = 0.5f / (float)MathFloat.sqrt(T);
- w = 0.25f / S;
- x = ( m[5] - m[7]) * S;
- y = ( m[6] - m[2]) * S;
- z = ( m[1] - m[3] ) * S;
- }
- else{
- if ((m[0] > m[4])&(m[0] > m[8])) {
- float S = MathFloat.sqrt( 1.0f + m[0] - m[4] - m[8] ) * 2f; // S=4*qx
- w = (m[7] - m[5]) / S;
- x = 0.25f * S;
- y = (m[3] + m[1]) / S;
- z = (m[6] + m[2]) / S;
- }
- else if (m[4] > m[8]) {
- float S = MathFloat.sqrt( 1.0f + m[4] - m[0] - m[8] ) * 2f; // S=4*qy
- w = (m[6] - m[2]) / S;
- x = (m[3] + m[1]) / S;
- y = 0.25f * S;
- z = (m[7] + m[5]) / S;
- }
- else {
- float S = MathFloat.sqrt( 1.0f + m[8] - m[0] - m[4] ) * 2f; // S=4*qz
- w = (m[3] - m[1]) / S;
- x = (m[6] + m[2]) / S;
- y = (m[7] + m[5]) / S;
- z = 0.25f * S;
- }
- }
- }
-
- /** Check if the the 3x3 matrix (param) is in fact
- * an affine rotational matrix
- * @param m 3x3 column matrix
- * @return true if representing a rotational matrix, false otherwise
- */
- public boolean isRotationMatrix(float[] m) {
- double epsilon = 0.01; // margin to allow for rounding errors
- if (MathFloat.abs(m[0]*m[3] + m[3]*m[4] + m[6]*m[7]) > epsilon) return false;
- if (MathFloat.abs(m[0]*m[2] + m[3]*m[5] + m[6]*m[8]) > epsilon) return false;
- if (MathFloat.abs(m[1]*m[2] + m[4]*m[5] + m[7]*m[8]) > epsilon) return false;
- if (MathFloat.abs(m[0]*m[0] + m[3]*m[3] + m[6]*m[6] - 1) > epsilon) return false;
- if (MathFloat.abs(m[1]*m[1] + m[4]*m[4] + m[7]*m[7] - 1) > epsilon) return false;
- if (MathFloat.abs(m[2]*m[2] + m[5]*m[5] + m[8]*m[8] - 1) > epsilon) return false;
- return (MathFloat.abs(determinant(m)-1) < epsilon);
- }
- private float determinant(float[] m) {
- return m[0]*m[4]*m[8] + m[3]*m[7]*m[2] + m[6]*m[1]*m[5] - m[0]*m[7]*m[5] - m[3]*m[1]*m[8] - m[6]*m[4]*m[2];
- }
+ matrix[12] = 0;
+ matrix[13] = 0;
+ matrix[14] = 0;
+ matrix[15] = 1;
+ return matrix;
+ }
+
+ /** Set this quaternion from a Sphereical interpolation
+ * of two param quaternion, used mostly for rotational animation
+ * @param a initial quaternion
+ * @param b target quaternion
+ * @param t float between 0 and 1 representing interp.
+ */
+ public void slerp(Quaternion a,Quaternion b, float t)
+ {
+ float omega, cosom, sinom, sclp, sclq;
+ cosom = a.x*b.x + a.y*b.y + a.z*b.z + a.w*b.w;
+ if ((1.0f+cosom) > MathFloat.E) {
+ if ((1.0f-cosom) > MathFloat.E) {
+ omega = (float)MathFloat.acos(cosom);
+ sinom = (float)MathFloat.sin(omega);
+ sclp = (float)MathFloat.sin((1.0f-t)*omega) / sinom;
+ sclq = (float)MathFloat.sin(t*omega) / sinom;
+ }
+ else {
+ sclp = 1.0f - t;
+ sclq = t;
+ }
+ x = sclp*a.x + sclq*b.x;
+ y = sclp*a.y + sclq*b.y;
+ z = sclp*a.z + sclq*b.z;
+ w = sclp*a.w + sclq*b.w;
+ }
+ else {
+ x =-a.y;
+ y = a.x;
+ z =-a.w;
+ w = a.z;
+ sclp = MathFloat.sin((1.0f-t) * MathFloat.PI * 0.5f);
+ sclq = MathFloat.sin(t * MathFloat.PI * 0.5f);
+ x = sclp*a.x + sclq*b.x;
+ y = sclp*a.y + sclq*b.y;
+ z = sclp*a.z + sclq*b.z;
+ }
+ }
+
+ /** Check if this quaternion is empty, ie (0,0,0,1)
+ * @return true if empty, false otherwise
+ */
+ public boolean isEmpty()
+ {
+ if (w==1 && x==0 && y==0 && z==0)
+ return true;
+ return false;
+ }
+
+ /** Check if this quaternion represents an identity
+ * matrix, for rotation.
+ * @return true if it is an identity rep., false otherwise
+ */
+ public boolean isIdentity()
+ {
+ if (w==0 && x==0 && y==0 && z==0)
+ return true;
+ return false;
+ }
+
+ /** compute the quaternion from a 3x3 column matrix
+ * @param m 3x3 column matrix
+ */
+ public void setFromMatrix(float[] m) {
+ float T= m[0] + m[4] + m[8] + 1;
+ if (T>0){
+ float S = 0.5f / (float)MathFloat.sqrt(T);
+ w = 0.25f / S;
+ x = ( m[5] - m[7]) * S;
+ y = ( m[6] - m[2]) * S;
+ z = ( m[1] - m[3] ) * S;
+ }
+ else{
+ if ((m[0] > m[4])&(m[0] > m[8])) {
+ float S = MathFloat.sqrt( 1.0f + m[0] - m[4] - m[8] ) * 2f; // S=4*qx
+ w = (m[7] - m[5]) / S;
+ x = 0.25f * S;
+ y = (m[3] + m[1]) / S;
+ z = (m[6] + m[2]) / S;
+ }
+ else if (m[4] > m[8]) {
+ float S = MathFloat.sqrt( 1.0f + m[4] - m[0] - m[8] ) * 2f; // S=4*qy
+ w = (m[6] - m[2]) / S;
+ x = (m[3] + m[1]) / S;
+ y = 0.25f * S;
+ z = (m[7] + m[5]) / S;
+ }
+ else {
+ float S = MathFloat.sqrt( 1.0f + m[8] - m[0] - m[4] ) * 2f; // S=4*qz
+ w = (m[3] - m[1]) / S;
+ x = (m[6] + m[2]) / S;
+ y = (m[7] + m[5]) / S;
+ z = 0.25f * S;
+ }
+ }
+ }
+
+ /** Check if the the 3x3 matrix (param) is in fact
+ * an affine rotational matrix
+ * @param m 3x3 column matrix
+ * @return true if representing a rotational matrix, false otherwise
+ */
+ public boolean isRotationMatrix(float[] m) {
+ double epsilon = 0.01; // margin to allow for rounding errors
+ if (MathFloat.abs(m[0]*m[3] + m[3]*m[4] + m[6]*m[7]) > epsilon) return false;
+ if (MathFloat.abs(m[0]*m[2] + m[3]*m[5] + m[6]*m[8]) > epsilon) return false;
+ if (MathFloat.abs(m[1]*m[2] + m[4]*m[5] + m[7]*m[8]) > epsilon) return false;
+ if (MathFloat.abs(m[0]*m[0] + m[3]*m[3] + m[6]*m[6] - 1) > epsilon) return false;
+ if (MathFloat.abs(m[1]*m[1] + m[4]*m[4] + m[7]*m[7] - 1) > epsilon) return false;
+ if (MathFloat.abs(m[2]*m[2] + m[5]*m[5] + m[8]*m[8] - 1) > epsilon) return false;
+ return (MathFloat.abs(determinant(m)-1) < epsilon);
+ }
+ private float determinant(float[] m) {
+ return m[0]*m[4]*m[8] + m[3]*m[7]*m[2] + m[6]*m[1]*m[5] - m[0]*m[7]*m[5] - m[3]*m[1]*m[8] - m[6]*m[4]*m[2];
+ }
}
diff --git a/src/jogl/classes/com/jogamp/graph/math/VectorUtil.java b/src/jogl/classes/com/jogamp/graph/math/VectorUtil.java
index cca9a45..7cbb742 100755
--- a/src/jogl/classes/com/jogamp/graph/math/VectorUtil.java
+++ b/src/jogl/classes/com/jogamp/graph/math/VectorUtil.java
@@ -35,261 +35,261 @@ import com.jogamp.graph.geom.Vertex;
public class VectorUtil {
- public static final int CW = -1;
- public static final int CCW = 1;
- public static final int COLLINEAR = 0;
+ public static final int CW = -1;
+ public static final int CCW = 1;
+ public static final int COLLINEAR = 0;
- /** compute the dot product of two points
- * @param vec1 vector 1
- * @param vec2 vector 2
- * @return the dot product as float
- */
- public static float dot(float[] vec1, float[] vec2)
- {
- return (vec1[0]*vec2[0] + vec1[1]*vec2[1] + vec1[2]*vec2[2]);
- }
- /** Normalize a vector
- * @param vector input vector
- * @return normalized vector
- */
- public static float[] normalize(float[] vector)
- {
- float[] newVector = new float[3];
+ /** compute the dot product of two points
+ * @param vec1 vector 1
+ * @param vec2 vector 2
+ * @return the dot product as float
+ */
+ public static float dot(float[] vec1, float[] vec2)
+ {
+ return (vec1[0]*vec2[0] + vec1[1]*vec2[1] + vec1[2]*vec2[2]);
+ }
+ /** Normalize a vector
+ * @param vector input vector
+ * @return normalized vector
+ */
+ public static float[] normalize(float[] vector)
+ {
+ float[] newVector = new float[3];
- float d = MathFloat.sqrt(vector[0]*vector[0] + vector[1]*vector[1] + vector[2]*vector[2]);
- if(d> 0.0f)
- {
- newVector[0] = vector[0]/d;
- newVector[1] = vector[1]/d;
- newVector[2] = vector[2]/d;
- }
- return newVector;
- }
+ float d = MathFloat.sqrt(vector[0]*vector[0] + vector[1]*vector[1] + vector[2]*vector[2]);
+ if(d> 0.0f)
+ {
+ newVector[0] = vector[0]/d;
+ newVector[1] = vector[1]/d;
+ newVector[2] = vector[2]/d;
+ }
+ return newVector;
+ }
- /** Scales a vector by param
- * @param vector input vector
- * @param scale constant to scale by
- * @return scaled vector
- */
- public static float[] scale(float[] vector, float scale)
- {
- float[] newVector = new float[3];
+ /** Scales a vector by param
+ * @param vector input vector
+ * @param scale constant to scale by
+ * @return scaled vector
+ */
+ public static float[] scale(float[] vector, float scale)
+ {
+ float[] newVector = new float[3];
- newVector[0] = vector[0]*scale;
- newVector[1] = vector[1]*scale;
- newVector[2] = vector[2]*scale;
- return newVector;
- }
-
- /** Adds to vectors
- * @param v1 vector 1
- * @param v2 vector 2
- * @return v1 + v2
- */
- public static float[] vectorAdd(float[] v1, float[] v2)
- {
- float[] newVector = new float[3];
+ newVector[0] = vector[0]*scale;
+ newVector[1] = vector[1]*scale;
+ newVector[2] = vector[2]*scale;
+ return newVector;
+ }
+
+ /** Adds to vectors
+ * @param v1 vector 1
+ * @param v2 vector 2
+ * @return v1 + v2
+ */
+ public static float[] vectorAdd(float[] v1, float[] v2)
+ {
+ float[] newVector = new float[3];
- newVector[0] = v1[0] + v2[0];
- newVector[1] = v1[1] + v2[1];
- newVector[2] = v1[2] + v2[2];
- return newVector;
- }
+ newVector[0] = v1[0] + v2[0];
+ newVector[1] = v1[1] + v2[1];
+ newVector[2] = v1[2] + v2[2];
+ return newVector;
+ }
- /** cross product vec1 x vec2
- * @param vec1 vector 1
- * @param vec2 vecttor 2
- * @return the resulting vector
- */
- public static float[] cross(float[] vec1, float[] vec2)
- {
- float[] out = new float[3];
+ /** cross product vec1 x vec2
+ * @param vec1 vector 1
+ * @param vec2 vecttor 2
+ * @return the resulting vector
+ */
+ public static float[] cross(float[] vec1, float[] vec2)
+ {
+ float[] out = new float[3];
- out[0] = vec2[2]*vec1[1] - vec2[1]*vec1[2];
- out[1] = vec2[0]*vec1[2] - vec2[2]*vec1[0];
- out[2] = vec2[1]*vec1[0] - vec2[0]*vec1[1];
+ out[0] = vec2[2]*vec1[1] - vec2[1]*vec1[2];
+ out[1] = vec2[0]*vec1[2] - vec2[2]*vec1[0];
+ out[2] = vec2[1]*vec1[0] - vec2[0]*vec1[1];
- return out;
- }
+ return out;
+ }
- /** Column Matrix Vector multiplication
- * @param colMatrix column matrix (4x4)
- * @param vec vector(x,y,z)
- * @return result new float[3]
- */
- public static float[] colMatrixVectorMult(float[] colMatrix, float[] vec)
- {
- float[] out = new float[3];
+ /** Column Matrix Vector multiplication
+ * @param colMatrix column matrix (4x4)
+ * @param vec vector(x,y,z)
+ * @return result new float[3]
+ */
+ public static float[] colMatrixVectorMult(float[] colMatrix, float[] vec)
+ {
+ float[] out = new float[3];
- out[0] = vec[0]*colMatrix[0] + vec[1]*colMatrix[4] + vec[2]*colMatrix[8] + colMatrix[12];
- out[1] = vec[0]*colMatrix[1] + vec[1]*colMatrix[5] + vec[2]*colMatrix[9] + colMatrix[13];
- out[2] = vec[0]*colMatrix[2] + vec[1]*colMatrix[6] + vec[2]*colMatrix[10] + colMatrix[14];
+ out[0] = vec[0]*colMatrix[0] + vec[1]*colMatrix[4] + vec[2]*colMatrix[8] + colMatrix[12];
+ out[1] = vec[0]*colMatrix[1] + vec[1]*colMatrix[5] + vec[2]*colMatrix[9] + colMatrix[13];
+ out[2] = vec[0]*colMatrix[2] + vec[1]*colMatrix[6] + vec[2]*colMatrix[10] + colMatrix[14];
- return out;
- }
-
- /** Matrix Vector multiplication
- * @param rawMatrix column matrix (4x4)
- * @param vec vector(x,y,z)
- * @return result new float[3]
- */
- public static float[] rowMatrixVectorMult(float[] rawMatrix, float[] vec)
- {
- float[] out = new float[3];
+ return out;
+ }
+
+ /** Matrix Vector multiplication
+ * @param rawMatrix column matrix (4x4)
+ * @param vec vector(x,y,z)
+ * @return result new float[3]
+ */
+ public static float[] rowMatrixVectorMult(float[] rawMatrix, float[] vec)
+ {
+ float[] out = new float[3];
- out[0] = vec[0]*rawMatrix[0] + vec[1]*rawMatrix[1] + vec[2]*rawMatrix[2] + rawMatrix[3];
- out[1] = vec[0]*rawMatrix[4] + vec[1]*rawMatrix[5] + vec[2]*rawMatrix[6] + rawMatrix[7];
- out[2] = vec[0]*rawMatrix[8] + vec[1]*rawMatrix[9] + vec[2]*rawMatrix[10] + rawMatrix[11];
+ out[0] = vec[0]*rawMatrix[0] + vec[1]*rawMatrix[1] + vec[2]*rawMatrix[2] + rawMatrix[3];
+ out[1] = vec[0]*rawMatrix[4] + vec[1]*rawMatrix[5] + vec[2]*rawMatrix[6] + rawMatrix[7];
+ out[2] = vec[0]*rawMatrix[8] + vec[1]*rawMatrix[9] + vec[2]*rawMatrix[10] + rawMatrix[11];
- return out;
- }
-
- /** Calculate the midpoint of two values
- * @param p1 first value
- * @param p2 second vale
- * @return midpoint
- */
- public static float mid(float p1, float p2)
- {
- return (p1+p2)/2.0f;
- }
- /** Calculate the midpoint of two points
- * @param p1 first point
- * @param p2 second point
- * @return midpoint
- */
- public static float[] mid(float[] p1, float[] p2)
- {
- float[] midPoint = new float[3];
- midPoint[0] = (p1[0] + p2[0])/2.0f;
- midPoint[1] = (p1[1] + p2[1])/2.0f;
- midPoint[2] = (p1[2] + p2[2])/2.0f;
+ return out;
+ }
+
+ /** Calculate the midpoint of two values
+ * @param p1 first value
+ * @param p2 second vale
+ * @return midpoint
+ */
+ public static float mid(float p1, float p2)
+ {
+ return (p1+p2)/2.0f;
+ }
+ /** Calculate the midpoint of two points
+ * @param p1 first point
+ * @param p2 second point
+ * @return midpoint
+ */
+ public static float[] mid(float[] p1, float[] p2)
+ {
+ float[] midPoint = new float[3];
+ midPoint[0] = (p1[0] + p2[0])/2.0f;
+ midPoint[1] = (p1[1] + p2[1])/2.0f;
+ midPoint[2] = (p1[2] + p2[2])/2.0f;
- return midPoint;
- }
- /** Compute the norm of a vector
- * @param vec vector
- * @return vorm
- */
- public static float norm(float[] vec)
- {
- return MathFloat.sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]);
- }
- /** Compute distance between 2 points
- * @param p0 a ref point on the line
- * @param vec vector representing the direction of the line
- * @param point the point to compute the relative distance of
- * @return distance float
- */
- public static float computeLength(float[] p0, float[] point)
- {
- float[] w = new float[]{point[0]-p0[0],point[1]-p0[1],point[2]-p0[2]};
+ return midPoint;
+ }
+ /** Compute the norm of a vector
+ * @param vec vector
+ * @return vorm
+ */
+ public static float norm(float[] vec)
+ {
+ return MathFloat.sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]);
+ }
+ /** Compute distance between 2 points
+ * @param p0 a ref point on the line
+ * @param vec vector representing the direction of the line
+ * @param point the point to compute the relative distance of
+ * @return distance float
+ */
+ public static float computeLength(float[] p0, float[] point)
+ {
+ float[] w = new float[]{point[0]-p0[0],point[1]-p0[1],point[2]-p0[2]};
- float distance = MathFloat.sqrt(w[0]*w[0] + w[1]*w[1] + w[2]*w[2]);
+ float distance = MathFloat.sqrt(w[0]*w[0] + w[1]*w[1] + w[2]*w[2]);
- return distance;
- }
+ return distance;
+ }
- /**Check equality of 2 vec3 vectors
- * @param v1 vertex 1
- * @param v2 vertex 2
- * @return
- */
- public static boolean checkEquality(float[] v1, float[] v2)
- {
- if(Float.compare(v1[0], v2[0]) == 0
- && Float.compare(v1[1] , v2[1]) == 0
- && Float.compare(v1[2], v2[2]) == 0 )
- return true;
- return false;
- }
+ /**Check equality of 2 vec3 vectors
+ * @param v1 vertex 1
+ * @param v2 vertex 2
+ * @return
+ */
+ public static boolean checkEquality(float[] v1, float[] v2)
+ {
+ if(Float.compare(v1[0], v2[0]) == 0
+ && Float.compare(v1[1] , v2[1]) == 0
+ && Float.compare(v1[2], v2[2]) == 0 )
+ return true;
+ return false;
+ }
- /** Compute the determinant of 3 vectors
- * @param a vector 1
- * @param b vector 2
- * @param c vector 3
- * @return the determinant value
- */
- public static float computeDeterminant(float[] a, float[] b, float[] c)
- {
- float area = a[0]*b[1]*c[2] + a[1]*b[2]*c[0] + a[2]*b[0]*c[1] - a[0]*b[2]*c[1] - a[1]*b[0]*c[2] - a[2]*b[1]*c[0];
- return area;
- }
+ /** Compute the determinant of 3 vectors
+ * @param a vector 1
+ * @param b vector 2
+ * @param c vector 3
+ * @return the determinant value
+ */
+ public static float computeDeterminant(float[] a, float[] b, float[] c)
+ {
+ float area = a[0]*b[1]*c[2] + a[1]*b[2]*c[0] + a[2]*b[0]*c[1] - a[0]*b[2]*c[1] - a[1]*b[0]*c[2] - a[2]*b[1]*c[0];
+ return area;
+ }
- /** Check if three vertices are colliniear
- * @param v1 vertex 1
- * @param v2 vertex 2
- * @param v3 vertex 3
- * @return true if collinear, false otherwise
- */
- public static boolean checkCollinear(float[] v1, float[] v2, float[] v3)
- {
- return (computeDeterminant(v1, v2, v3) == VectorUtil.COLLINEAR);
- }
+ /** Check if three vertices are colliniear
+ * @param v1 vertex 1
+ * @param v2 vertex 2
+ * @param v3 vertex 3
+ * @return true if collinear, false otherwise
+ */
+ public static boolean checkCollinear(float[] v1, float[] v2, float[] v3)
+ {
+ return (computeDeterminant(v1, v2, v3) == VectorUtil.COLLINEAR);
+ }
- /** Compute Vector
- * @param v1 vertex 1
- * @param v2 vertex2 2
- * @return Vector V1V2
- */
- public static float[] computeVector(float[] v1, float[] v2)
- {
- float[] vector = new float[3];
- vector[0] = v2[0] - v1[0];
- vector[1] = v2[1] - v1[1];
- vector[2] = v2[2] - v1[2];
- return vector;
- }
+ /** Compute Vector
+ * @param v1 vertex 1
+ * @param v2 vertex2 2
+ * @return Vector V1V2
+ */
+ public static float[] computeVector(float[] v1, float[] v2)
+ {
+ float[] vector = new float[3];
+ vector[0] = v2[0] - v1[0];
+ vector[1] = v2[1] - v1[1];
+ vector[2] = v2[2] - v1[2];
+ return vector;
+ }
- /** Check if vertices in triangle circumcircle
- * @param a triangle vertex 1
- * @param b triangle vertex 2
- * @param c triangle vertex 3
- * @param d vertex in question
- * @return true if the vertex d is inside the circle defined by the
- * vertices a, b, c. from paper by Guibas and Stolfi (1985).
- */
- public static boolean inCircle(Vertex a, Vertex b, Vertex c, Vertex d){
- return (a.getX() * a.getX() + a.getY() * a.getY()) * triArea(b, c, d) -
- (b.getX() * b.getX() + b.getY() * b.getY()) * triArea(a, c, d) +
- (c.getX() * c.getX() + c.getY() * c.getY()) * triArea(a, b, d) -
- (d.getX() * d.getX() + d.getY() * d.getY()) * triArea(a, b, c) > 0;
- }
+ /** Check if vertices in triangle circumcircle
+ * @param a triangle vertex 1
+ * @param b triangle vertex 2
+ * @param c triangle vertex 3
+ * @param d vertex in question
+ * @return true if the vertex d is inside the circle defined by the
+ * vertices a, b, c. from paper by Guibas and Stolfi (1985).
+ */
+ public static boolean inCircle(Vertex a, Vertex b, Vertex c, Vertex d){
+ return (a.getX() * a.getX() + a.getY() * a.getY()) * triArea(b, c, d) -
+ (b.getX() * b.getX() + b.getY() * b.getY()) * triArea(a, c, d) +
+ (c.getX() * c.getX() + c.getY() * c.getY()) * triArea(a, b, d) -
+ (d.getX() * d.getX() + d.getY() * d.getY()) * triArea(a, b, c) > 0;
+ }
- /** Computes oriented area of a triangle
- * @param a first vertex
- * @param b second vertex
- * @param c third vertex
- * @return compute twice the area of the oriented triangle (a,b,c), the area
- * is positive if the triangle is oriented counterclockwise.
- */
- public static float triArea(Vertex a, Vertex b, Vertex c){
- return (b.getX() - a.getX()) * (c.getY() - a.getY()) - (b.getY() - a.getY())*(c.getX() - a.getX());
- }
+ /** Computes oriented area of a triangle
+ * @param a first vertex
+ * @param b second vertex
+ * @param c third vertex
+ * @return compute twice the area of the oriented triangle (a,b,c), the area
+ * is positive if the triangle is oriented counterclockwise.
+ */
+ public static float triArea(Vertex a, Vertex b, Vertex c){
+ return (b.getX() - a.getX()) * (c.getY() - a.getY()) - (b.getY() - a.getY())*(c.getX() - a.getX());
+ }
- /** Check if points are in ccw order
- * @param a first vertex
- * @param b second vertex
- * @param c third vertex
- * @return true if the points a,b,c are in a ccw order
- */
- public static boolean ccw(Vertex a, Vertex b, Vertex c){
- return triArea(a,b,c) > 0;
- }
+ /** Check if points are in ccw order
+ * @param a first vertex
+ * @param b second vertex
+ * @param c third vertex
+ * @return true if the points a,b,c are in a ccw order
+ */
+ public static boolean ccw(Vertex a, Vertex b, Vertex c){
+ return triArea(a,b,c) > 0;
+ }
- /** Computes the area of a list of vertices to check if ccw
- * @param vertices
- * @return positve area if ccw else negative area value
- */
- public static float area(ArrayList<Vertex> vertices) {
- int n = vertices.size();
- float area = 0.0f;
- for (int p = n - 1, q = 0; q < n; p = q++)
- {
- float[] pCoord = vertices.get(p).getCoord();
- float[] qCoord = vertices.get(q).getCoord();
- area += pCoord[0] * qCoord[1] - qCoord[0] * pCoord[1];
- }
- return area;
- }
+ /** Computes the area of a list of vertices to check if ccw
+ * @param vertices
+ * @return positve area if ccw else negative area value
+ */
+ public static float area(ArrayList<Vertex> vertices) {
+ int n = vertices.size();
+ float area = 0.0f;
+ for (int p = n - 1, q = 0; q < n; p = q++)
+ {
+ float[] pCoord = vertices.get(p).getCoord();
+ float[] qCoord = vertices.get(q).getCoord();
+ area += pCoord[0] * qCoord[1] - qCoord[0] * pCoord[1];
+ }
+ return area;
+ }
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
index fc364b6..f59351a 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
@@ -116,9 +116,9 @@ public class FPSAnimator extends AnimatorBase {
}
private void startTask() {
- if(null != task) {
- return;
- }
+ if(null != task) {
+ return;
+ }
long delay = (long) (1000.0f / (float) fps);
task = new TimerTask() {
public void run() {
@@ -165,12 +165,12 @@ public class FPSAnimator extends AnimatorBase {
try {
shouldRun = false;
if(null != task) {
- task.cancel();
- task = null;
+ task.cancel();
+ task = null;
}
if(null != timer) {
- timer.cancel();
- timer = null;
+ timer.cancel();
+ timer = null;
}
animThread = null;
try {
@@ -190,8 +190,8 @@ public class FPSAnimator extends AnimatorBase {
try {
shouldRun = false;
if(null != task) {
- task.cancel();
- task = null;
+ task.cancel();
+ task = null;
}
animThread = null;
try {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/Locator.java b/src/jogl/classes/com/jogamp/opengl/util/Locator.java
index 8dbd7cd..291cd77 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/Locator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/Locator.java
@@ -109,7 +109,7 @@ public class Locator {
}
if (file != null) {
String res = new File(file, relativeFile).getPath();
- // Handle things on Windows
+ // Handle things on Windows
return res.replace('\\', '/');
} else {
return relativeFile;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
index 8688217..de28dc7 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
@@ -1590,7 +1590,7 @@ public class TextRenderer {
int lengthInGlyphs = fullRunGlyphVector.getNumGlyphs();
int i = 0;
while (i < lengthInGlyphs) {
- Character letter = CharacterCache.valueOf(inString.charAt(i));
+ Character letter = CharacterCache.valueOf(inString.charAt(i));
GlyphMetrics metrics = (GlyphMetrics) glyphMetricsCache.get(letter);
if (metrics == null) {
metrics = fullRunGlyphVector.getGlyphMetrics(i);
@@ -1656,7 +1656,7 @@ public class TextRenderer {
// if the unicode or glyph ID would be out of bounds of the
// glyph cache.
private Glyph getGlyph(CharSequence inString,
- GlyphMetrics glyphMetrics,
+ GlyphMetrics glyphMetrics,
int index) {
char unicodeID = inString.charAt(index);
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java
index 8befc13..010ce66 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java
@@ -163,7 +163,7 @@ public class GLUT {
public void glutSolidCylinder(double radius, double height, int slices, int stacks) {
GL2 gl = GLUgl2.getCurrentGL2();
-
+
// Prepare table of points for drawing end caps
double [] x = new double[slices];
double [] y = new double[slices];
@@ -174,7 +174,7 @@ public class GLUT {
x[i] = Math.cos(angle) * radius;
y[i] = Math.sin(angle) * radius;
}
-
+
// Draw bottom cap
gl.glBegin(GL2.GL_TRIANGLE_FAN);
gl.glNormal3d(0,0,-1);
@@ -184,7 +184,7 @@ public class GLUT {
}
gl.glVertex3d(x[0], y[0], 0);
gl.glEnd();
-
+
// Draw top cap
gl.glBegin(GL2.GL_TRIANGLE_FAN);
gl.glNormal3d(0,0,1);
@@ -194,7 +194,7 @@ public class GLUT {
}
gl.glVertex3d(x[0], y[0], height);
gl.glEnd();
-
+
// Draw walls
quadObjInit(glu);
glu.gluQuadricDrawStyle(quadObj, GLU.GLU_FILL);
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
index 38f8ff9..c067e5c 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
@@ -193,18 +193,18 @@ public class Texture {
// Package-private constructor for creating a texture object which wraps
// an existing texture ID from another package
Texture(int textureID,
- int target,
- int texWidth,
- int texHeight,
- int imgWidth,
- int imgHeight,
- boolean mustFlipVertically) {
- this.texID = textureID;
- this.target = target;
- this.mustFlipVertically = mustFlipVertically;
- this.texWidth = texWidth;
- this.texHeight = texHeight;
- setImageSize(imgWidth, imgHeight, target);
+ int target,
+ int texWidth,
+ int texHeight,
+ int imgWidth,
+ int imgHeight,
+ boolean mustFlipVertically) {
+ this.texID = textureID;
+ this.target = target;
+ this.mustFlipVertically = mustFlipVertically;
+ this.texWidth = texWidth;
+ this.texHeight = texHeight;
+ setImageSize(imgWidth, imgHeight, target);
}
/**
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java
index e86ff16..d21e9c5 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java
@@ -528,19 +528,19 @@ public class TextureIO {
* texture
*/
public static Texture newTexture(int textureID,
- int target,
- int texWidth,
- int texHeight,
- int imgWidth,
- int imgHeight,
- boolean mustFlipVertically) {
- return new Texture(textureID,
- target,
- texWidth,
- texHeight,
- imgWidth,
- imgHeight,
- mustFlipVertically);
+ int target,
+ int texWidth,
+ int texHeight,
+ int imgWidth,
+ int imgHeight,
+ boolean mustFlipVertically) {
+ return new Texture(textureID,
+ target,
+ texWidth,
+ texHeight,
+ imgWidth,
+ imgHeight,
+ mustFlipVertically);
}
/**
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java
index d5f4959..37dbc54 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.jogamp.opengl.util.texture.spi;
+package com.jogamp.opengl.util.texture.spi;
import java.io.DataInput;
import java.io.DataInputStream;
@@ -65,16 +65,16 @@ import java.io.IOException;
* for that functionality. It is not clear if it is ever going to be
* functionally required to be able to read UTF data in a LittleEndianManner<p>
*
- * @author Robin Luiten
- * @version 1.1 15/Dec/1997
+ * @author Robin Luiten
+ * @version 1.1 15/Dec/1997
*/
public class LEDataInputStream extends FilterInputStream implements DataInput
{
/**
- * To reuse some of the non endian dependent methods from
- * DataInputStreams methods.
+ * To reuse some of the non endian dependent methods from
+ * DataInputStreams methods.
*/
- DataInputStream dataIn;
+ DataInputStream dataIn;
public LEDataInputStream(InputStream in)
{
@@ -84,29 +84,29 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
public void close() throws IOException
{
- dataIn.close(); // better close as we create it.
+ dataIn.close(); // better close as we create it.
// this will close underlying as well.
}
- public synchronized final int read(byte b[]) throws IOException
+ public synchronized final int read(byte b[]) throws IOException
{
return dataIn.read(b, 0, b.length);
}
- public synchronized final int read(byte b[], int off, int len) throws IOException
+ public synchronized final int read(byte b[], int off, int len) throws IOException
{
- int rl = dataIn.read(b, off, len);
+ int rl = dataIn.read(b, off, len);
return rl;
}
public final void readFully(byte b[]) throws IOException
{
- dataIn.readFully(b, 0, b.length);
+ dataIn.readFully(b, 0, b.length);
}
- public final void readFully(byte b[], int off, int len) throws IOException
+ public final void readFully(byte b[], int off, int len) throws IOException
{
- dataIn.readFully(b, off, len);
+ dataIn.readFully(b, off, len);
}
public final int skipBytes(int n) throws IOException
@@ -116,23 +116,23 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
public final boolean readBoolean() throws IOException
{
- int ch = dataIn.read();
+ int ch = dataIn.read();
if (ch < 0)
throw new EOFException();
return (ch != 0);
}
- public final byte readByte() throws IOException
+ public final byte readByte() throws IOException
{
- int ch = dataIn.read();
+ int ch = dataIn.read();
if (ch < 0)
throw new EOFException();
return (byte)(ch);
}
- public final int readUnsignedByte() throws IOException
+ public final int readUnsignedByte() throws IOException
{
- int ch = dataIn.read();
+ int ch = dataIn.read();
if (ch < 0)
throw new EOFException();
return ch;
@@ -140,47 +140,47 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
public final short readShort() throws IOException
{
- int ch1 = dataIn.read();
- int ch2 = dataIn.read();
- if ((ch1 | ch2) < 0)
+ int ch1 = dataIn.read();
+ int ch2 = dataIn.read();
+ if ((ch1 | ch2) < 0)
throw new EOFException();
- return (short)((ch1 << 0) + (ch2 << 8));
+ return (short)((ch1 << 0) + (ch2 << 8));
}
- public final int readUnsignedShort() throws IOException
+ public final int readUnsignedShort() throws IOException
{
- int ch1 = dataIn.read();
- int ch2 = dataIn.read();
- if ((ch1 | ch2) < 0)
+ int ch1 = dataIn.read();
+ int ch2 = dataIn.read();
+ if ((ch1 | ch2) < 0)
throw new EOFException();
- return (ch1 << 0) + (ch2 << 8);
+ return (ch1 << 0) + (ch2 << 8);
}
- public final char readChar() throws IOException
+ public final char readChar() throws IOException
{
- int ch1 = dataIn.read();
- int ch2 = dataIn.read();
- if ((ch1 | ch2) < 0)
+ int ch1 = dataIn.read();
+ int ch2 = dataIn.read();
+ if ((ch1 | ch2) < 0)
throw new EOFException();
- return (char)((ch1 << 0) + (ch2 << 8));
+ return (char)((ch1 << 0) + (ch2 << 8));
}
public final int readInt() throws IOException
{
- int ch1 = dataIn.read();
- int ch2 = dataIn.read();
- int ch3 = dataIn.read();
- int ch4 = dataIn.read();
- if ((ch1 | ch2 | ch3 | ch4) < 0)
+ int ch1 = dataIn.read();
+ int ch2 = dataIn.read();
+ int ch3 = dataIn.read();
+ int ch4 = dataIn.read();
+ if ((ch1 | ch2 | ch3 | ch4) < 0)
throw new EOFException();
- return ((ch1 << 0) + (ch2 << 8) + (ch3 << 16) + (ch4 << 24));
+ return ((ch1 << 0) + (ch2 << 8) + (ch3 << 16) + (ch4 << 24));
}
- public final long readLong() throws IOException
+ public final long readLong() throws IOException
{
- int i1 = readInt();
- int i2 = readInt();
- return ((long)(i1) & 0xFFFFFFFFL) + (i2 << 32);
+ int i1 = readInt();
+ int i2 = readInt();
+ return ((long)(i1) & 0xFFFFFFFFL) + (i2 << 32);
}
public final float readFloat() throws IOException
@@ -188,7 +188,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
return Float.intBitsToFloat(readInt());
}
- public final double readDouble() throws IOException
+ public final double readDouble() throws IOException
{
return Double.longBitsToDouble(readLong());
}
@@ -197,7 +197,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
* dont call this it is not implemented.
* @return empty new string
**/
- public final String readLine() throws IOException
+ public final String readLine() throws IOException
{
return new String();
}
@@ -206,7 +206,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
* dont call this it is not implemented
* @return empty new string
**/
- public final String readUTF() throws IOException
+ public final String readUTF() throws IOException
{
return new String();
}
@@ -215,7 +215,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
* dont call this it is not implemented
* @return empty new string
**/
- public final static String readUTF(DataInput in) throws IOException
+ public final static String readUTF(DataInput in) throws IOException
{
return new String();
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java
index bb5040a..c60c91b 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java
@@ -477,7 +477,7 @@ public class SGIImage {
for (int z = 0; z < zsize; z++) {
for (int y = ystart; y != yend; y += yincr) {
// RLE-compress each row.
-
+
int x = 0;
byte count = 0;
boolean repeat_mode = false;
@@ -485,7 +485,7 @@ public class SGIImage {
int start_ptr = ptr;
int num_ptr = ptr++;
byte repeat_val = 0;
-
+
while (x < xsize) {
// see if we should switch modes
should_switch = false;
@@ -502,7 +502,7 @@ public class SGIImage {
if (DEBUG)
System.err.println("left side was " + ((int) imgref(data, x, y, z, xsize, ysize, zsize)) +
", right side was " + (int)imgref(data, x+i, y, z, xsize, ysize, zsize));
-
+
if (imgref(data, x, y, z, xsize, ysize, zsize) !=
imgref(data, x+i, y, z, xsize, ysize, zsize))
should_switch = false;
@@ -530,7 +530,7 @@ public class SGIImage {
repeat_mode = true;
repeat_val = imgref(data, x, y, z, xsize, ysize, zsize);
}
-
+
if (x > 0) {
// reset the number pointer
num_ptr = ptr++;
@@ -538,7 +538,7 @@ public class SGIImage {
count = 0;
}
}
-
+
// if not in repeat mode, copy element to ptr
if (!repeat_mode) {
rlebuf[ptr++] = imgref(data, x, y, z, xsize, ysize, zsize);
diff --git a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
index 9352ad4..52628f6 100644
--- a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
+++ b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
@@ -230,7 +230,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
// Don't substitute a positive score for a smaller negative score
if ((scoreClosestToZero == NO_SCORE) ||
(Math.abs(score) < Math.abs(scoreClosestToZero) &&
- ((sign(scoreClosestToZero) < 0) || (sign(score) > 0)))) {
+ ((sign(scoreClosestToZero) < 0) || (sign(score) > 0)))) {
scoreClosestToZero = score;
chosenIndex = i;
}
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index 4076dac..dc439f3 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -745,9 +745,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
@Override
public String toString() {
- final int dw = (null!=drawable) ? drawable.getWidth() : -1;
- final int dh = (null!=drawable) ? drawable.getHeight() : -1;
-
+ final int dw = (null!=drawable) ? drawable.getWidth() : -1;
+ final int dh = (null!=drawable) ? drawable.getHeight() : -1;
+
return "AWT-GLCanvas[Realized "+isRealized()+
",\n\t"+((null!=drawable)?drawable.getClass().getName():"null-drawable")+
",\n\tRealized "+isRealized()+
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
index 34b46a8..683a72d 100755
--- a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
@@ -43,10 +43,10 @@ import com.jogamp.opengl.util.glsl.ShaderState;
public class RegionRendererImpl01 extends RegionRenderer {
- /**Sharpness is equivalent to the value of t value of texture coord
- * on the off-curve vertex. The high value of sharpness will
- * result in high curvature.
- */
+ /**Sharpness is equivalent to the value of t value of texture coord
+ * on the off-curve vertex. The high value of sharpness will
+ * result in high curvature.
+ */
private GLUniformData mgl_sharpness = new GLUniformData("p1y", 0.5f);
GLUniformData mgl_alpha = new GLUniformData("g_alpha", 1.0f);
private GLUniformData mgl_color = new GLUniformData("g_color", 3, FloatBuffer.allocate(3));
@@ -174,35 +174,35 @@ public class RegionRendererImpl01 extends RegionRenderer {
}
}
-
- @Override
+
+ @Override
public void renderOutlineShape(GL2ES2 gl, OutlineShape outlineShape, float[] position, int texSize) {
- if(!isInitialized()){
- throw new GLException("RegionRendererImpl01: not initialized!");
- }
- int hashCode = getHashCode(outlineShape);
- Region region = regions.get(hashCode);
-
- if(null == region) {
- region = createRegion(gl, outlineShape, mgl_sharpness.floatValue());
- regions.put(hashCode, region);
- }
- region.render(pmvMatrix, vp_width, vp_height, texSize);
- }
-
- @Override
+ if(!isInitialized()){
+ throw new GLException("RegionRendererImpl01: not initialized!");
+ }
+ int hashCode = getHashCode(outlineShape);
+ Region region = regions.get(hashCode);
+
+ if(null == region) {
+ region = createRegion(gl, outlineShape, mgl_sharpness.floatValue());
+ regions.put(hashCode, region);
+ }
+ region.render(pmvMatrix, vp_width, vp_height, texSize);
+ }
+
+ @Override
public void renderOutlineShapes(GL2ES2 gl, OutlineShape[] outlineShapes, float[] position, int texSize) {
if(!isInitialized()){
throw new GLException("RegionRendererImpl01: not initialized!");
}
-
- int hashCode = getHashCode(outlineShapes);
- Region region = regions.get(hashCode);
-
- if(null == region) {
+
+ int hashCode = getHashCode(outlineShapes);
+ Region region = regions.get(hashCode);
+
+ if(null == region) {
region = createRegion(gl, outlineShapes, mgl_sharpness.floatValue());
- regions.put(hashCode, region);
- }
+ regions.put(hashCode, region);
+ }
region.render(pmvMatrix, vp_width, vp_height, texSize);
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
index 69a8e47..bc94ab1 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
@@ -44,39 +44,39 @@ import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
public class TextRendererImpl01 extends TextRenderer {
- /**Sharpness is equivalent to the value of t value of texture coord
- * on the off-curve vertex. The high value of sharpness will
- * result in high curvature.
- */
+ /**Sharpness is equivalent to the value of t value of texture coord
+ * on the off-curve vertex. The high value of sharpness will
+ * result in high curvature.
+ */
private GLUniformData mgl_sharpness = new GLUniformData("p1y", 0.5f);
GLUniformData mgl_alpha = new GLUniformData("g_alpha", 1.0f);
private GLUniformData mgl_color = new GLUniformData("g_color", 3, FloatBuffer.allocate(3));
private GLUniformData mgl_strength = new GLUniformData("a_strength", 1.8f);
-
- public TextRendererImpl01(Vertex.Factory<? extends Vertex> factory, int type) {
- super(factory, type);
- }
+
+ public TextRendererImpl01(Vertex.Factory<? extends Vertex> factory, int type) {
+ super(factory, type);
+ }
- @Override
+ @Override
protected boolean initImpl(GL2ES2 gl){
- boolean VBOsupported = gl.isFunctionAvailable("glGenBuffers") &&
- gl.isFunctionAvailable("glBindBuffer") &&
- gl.isFunctionAvailable("glBufferData") &&
- gl.isFunctionAvailable("glDrawElements") &&
- gl.isFunctionAvailable("glVertexAttribPointer") &&
- gl.isFunctionAvailable("glDeleteBuffers");
-
- if(DEBUG) {
- System.err.println("TextRendererImpl01: VBO Supported = " + VBOsupported);
- }
-
- if(!VBOsupported){
- return false;
- }
-
- gl.glEnable(GL2ES2.GL_BLEND);
- gl.glBlendFunc(GL2ES2.GL_SRC_ALPHA, GL2ES2.GL_ONE_MINUS_SRC_ALPHA);
-
+ boolean VBOsupported = gl.isFunctionAvailable("glGenBuffers") &&
+ gl.isFunctionAvailable("glBindBuffer") &&
+ gl.isFunctionAvailable("glBufferData") &&
+ gl.isFunctionAvailable("glDrawElements") &&
+ gl.isFunctionAvailable("glVertexAttribPointer") &&
+ gl.isFunctionAvailable("glDeleteBuffers");
+
+ if(DEBUG) {
+ System.err.println("TextRendererImpl01: VBO Supported = " + VBOsupported);
+ }
+
+ if(!VBOsupported){
+ return false;
+ }
+
+ gl.glEnable(GL2ES2.GL_BLEND);
+ gl.glBlendFunc(GL2ES2.GL_SRC_ALPHA, GL2ES2.GL_ONE_MINUS_SRC_ALPHA);
+
ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, 1, TextRendererImpl01.class,
"shader", "shader/bin", "curverenderer01");
ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, 1, TextRendererImpl01.class,
@@ -95,62 +95,62 @@ public class TextRendererImpl01 extends TextRenderer {
}
st.attachShaderProgram(gl, sp);
-
- st.glUseProgram(gl, true);
+
+ st.glUseProgram(gl, true);
- pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
- pmvMatrix.glLoadIdentity();
- pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
- pmvMatrix.glLoadIdentity();
-
- pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
- pmvMatrix.glLoadIdentity();
- resetModelview(null);
-
- mgl_PMVMatrix = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf());
- if(!st.glUniform(gl, mgl_PMVMatrix)) {
- if(DEBUG){
- System.err.println("Error setting PMVMatrix in shader: "+st);
- }
- return false;
- }
-
- if(!st.glUniform(gl, mgl_sharpness)) {
- if(DEBUG){
- System.err.println("Error setting sharpness in shader: "+st);
- }
- return false;
- }
-
- if(!st.glUniform(gl, mgl_alpha)) {
- if(DEBUG){
- System.err.println("Error setting global alpha in shader: "+st);
- }
- return false;
- }
-
- if(!st.glUniform(gl, mgl_color)) {
- if(DEBUG){
- System.err.println("Error setting global color in shader: "+st);
- }
- return false;
- }
-
- if(!st.glUniform(gl, mgl_strength)) {
- System.err.println("Error setting antialias strength in shader: "+st);
- }
-
- if(DEBUG) {
- System.err.println("TextRendererImpl01 initialized: " + Thread.currentThread()+" "+st);
- }
- return true;
- }
-
- @Override
+ pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+ pmvMatrix.glLoadIdentity();
+ pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
+ pmvMatrix.glLoadIdentity();
+
+ pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+ pmvMatrix.glLoadIdentity();
+ resetModelview(null);
+
+ mgl_PMVMatrix = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf());
+ if(!st.glUniform(gl, mgl_PMVMatrix)) {
+ if(DEBUG){
+ System.err.println("Error setting PMVMatrix in shader: "+st);
+ }
+ return false;
+ }
+
+ if(!st.glUniform(gl, mgl_sharpness)) {
+ if(DEBUG){
+ System.err.println("Error setting sharpness in shader: "+st);
+ }
+ return false;
+ }
+
+ if(!st.glUniform(gl, mgl_alpha)) {
+ if(DEBUG){
+ System.err.println("Error setting global alpha in shader: "+st);
+ }
+ return false;
+ }
+
+ if(!st.glUniform(gl, mgl_color)) {
+ if(DEBUG){
+ System.err.println("Error setting global color in shader: "+st);
+ }
+ return false;
+ }
+
+ if(!st.glUniform(gl, mgl_strength)) {
+ System.err.println("Error setting antialias strength in shader: "+st);
+ }
+
+ if(DEBUG) {
+ System.err.println("TextRendererImpl01 initialized: " + Thread.currentThread()+" "+st);
+ }
+ return true;
+ }
+
+ @Override
protected void disposeImpl(GL2ES2 gl) {
- super.disposeImpl(gl);
- }
-
+ super.disposeImpl(gl);
+ }
+
@Override
public float getAlpha() {
return mgl_alpha.floatValue();
@@ -163,30 +163,30 @@ public class TextRendererImpl01 extends TextRenderer {
st.glUniform(gl, mgl_alpha);
}
}
-
- @Override
+
+ @Override
public void setColor(GL2ES2 gl, float r, float g, float b){
- FloatBuffer fb = (FloatBuffer) mgl_color.getBuffer();
- fb.put(0, r);
- fb.put(1, r);
- fb.put(2, r);
- if(null != gl && st.inUse()) {
- st.glUniform(gl, mgl_color);
- }
- }
-
- @Override
+ FloatBuffer fb = (FloatBuffer) mgl_color.getBuffer();
+ fb.put(0, r);
+ fb.put(1, r);
+ fb.put(2, r);
+ if(null != gl && st.inUse()) {
+ st.glUniform(gl, mgl_color);
+ }
+ }
+
+ @Override
public void renderString3D(GL2ES2 gl, Font font, String str, float[] position, int fontSize, int texSize) {
- if(!isInitialized()){
- throw new GLException("TextRendererImpl01: not initialized!");
- }
- GlyphString glyphString = getCachedGlyphString(font, str, fontSize);
- if(null == glyphString) {
- glyphString = createString(gl, font, fontSize, str, mgl_sharpness.floatValue());
- addCachedGlyphString(font, str, fontSize, glyphString);
- }
-
- glyphString.renderString3D(pmvMatrix, vp_width, vp_height, texSize);
- }
-
+ if(!isInitialized()){
+ throw new GLException("TextRendererImpl01: not initialized!");
+ }
+ GlyphString glyphString = getCachedGlyphString(font, str, fontSize);
+ if(null == glyphString) {
+ glyphString = createString(gl, font, fontSize, str, mgl_sharpness.floatValue());
+ addCachedGlyphString(font, str, fontSize, glyphString);
+ }
+
+ glyphString.renderString3D(pmvMatrix, vp_width, vp_height, texSize);
+ }
+
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
index 81d9d18..0581496 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
@@ -49,35 +49,35 @@ import com.jogamp.opengl.util.glsl.ShaderState;
public class VBORegion2PES2 implements Region {
private int numVertices = 0;
- private ArrayList<Triangle> triangles = new ArrayList<Triangle>();
- private ArrayList<Vertex> vertices = new ArrayList<Vertex>();
- private GLArrayDataServer verticeTxtAttr = null;
- private GLArrayDataServer texCoordTxtAttr = null;
- private GLArrayDataServer indicesTxt = null;
+ private ArrayList<Triangle> triangles = new ArrayList<Triangle>();
+ private ArrayList<Vertex> vertices = new ArrayList<Vertex>();
+ private GLArrayDataServer verticeTxtAttr = null;
+ private GLArrayDataServer texCoordTxtAttr = null;
+ private GLArrayDataServer indicesTxt = null;
private GLArrayDataServer verticeFboAttr = null;
private GLArrayDataServer texCoordFboAttr = null;
private GLArrayDataServer indicesFbo = null;
-
- private GLContext context;
-
- private boolean flipped = false;
-
- private boolean dirty = false;
-
- private AABBox box = null;
- private FBObject fbo = null;
+
+ private GLContext context;
+
+ private boolean flipped = false;
+
+ private boolean dirty = false;
+
+ private AABBox box = null;
+ private FBObject fbo = null;
- private int tex_width_c = 0;
- private int tex_height_c = 0;
-
- private ShaderState st;
-
- public VBORegion2PES2(GLContext context, ShaderState st){
- this.context =context;
- this.st = st;
-
- GL2ES2 gl = context.getGL().getGL2ES2();
-
+ private int tex_width_c = 0;
+ private int tex_height_c = 0;
+
+ private ShaderState st;
+
+ public VBORegion2PES2(GLContext context, ShaderState st){
+ this.context =context;
+ this.st = st;
+
+ GL2ES2 gl = context.getGL().getGL2ES2();
+
indicesFbo = GLArrayDataServer.createGLSL(gl, null, 3, GL2ES2.GL_SHORT, false,
2, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
indicesFbo.puts((short) 0); indicesFbo.puts((short) 1); indicesFbo.puts((short) 3);
@@ -108,132 +108,132 @@ public class VBORegion2PES2 implements Region {
if(DEBUG) {
System.err.println("VBORegion2PES2 Create: " + this);
}
- }
-
- public void update(){
- GL2ES2 gl = context.getGL().getGL2ES2();
-
+ }
+
+ public void update(){
+ GL2ES2 gl = context.getGL().getGL2ES2();
+
destroyTxtAttr(gl);
box = new AABBox();
indicesTxt = GLArrayDataServer.createGLSL(gl, null, 3, GL2ES2.GL_SHORT, false,
triangles.size(), GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
- for(Triangle t:triangles){
- if(t.getVertices()[0].getId() == Integer.MAX_VALUE){
- t.getVertices()[0].setId(numVertices++);
- t.getVertices()[1].setId(numVertices++);
- t.getVertices()[2].setId(numVertices++);
-
- vertices.add(t.getVertices()[0]);
- vertices.add(t.getVertices()[1]);
- vertices.add(t.getVertices()[2]);
-
- indicesTxt.puts((short) t.getVertices()[0].getId());
- indicesTxt.puts((short) t.getVertices()[1].getId());
- indicesTxt.puts((short) t.getVertices()[2].getId());
- }
- else{
- Vertex v1 = t.getVertices()[0];
- Vertex v2 = t.getVertices()[1];
- Vertex v3 = t.getVertices()[2];
-
- indicesTxt.puts((short) v1.getId());
- indicesTxt.puts((short) v2.getId());
- indicesTxt.puts((short) v3.getId());
- }
- }
+ for(Triangle t:triangles){
+ if(t.getVertices()[0].getId() == Integer.MAX_VALUE){
+ t.getVertices()[0].setId(numVertices++);
+ t.getVertices()[1].setId(numVertices++);
+ t.getVertices()[2].setId(numVertices++);
+
+ vertices.add(t.getVertices()[0]);
+ vertices.add(t.getVertices()[1]);
+ vertices.add(t.getVertices()[2]);
+
+ indicesTxt.puts((short) t.getVertices()[0].getId());
+ indicesTxt.puts((short) t.getVertices()[1].getId());
+ indicesTxt.puts((short) t.getVertices()[2].getId());
+ }
+ else{
+ Vertex v1 = t.getVertices()[0];
+ Vertex v2 = t.getVertices()[1];
+ Vertex v3 = t.getVertices()[2];
+
+ indicesTxt.puts((short) v1.getId());
+ indicesTxt.puts((short) v2.getId());
+ indicesTxt.puts((short) v3.getId());
+ }
+ }
indicesTxt.seal(gl, true);
verticeTxtAttr = GLArrayDataServer.createGLSL(gl, Region.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, false,
vertices.size(), GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER);
verticeTxtAttr.setLocation(Region.VERTEX_ATTR_IDX);
- for(Vertex v:vertices){
- verticeTxtAttr.putf(v.getX());
- if(flipped){
- verticeTxtAttr.putf(-1*v.getY());
- } else {
- verticeTxtAttr.putf(v.getY());
- }
- verticeTxtAttr.putf(v.getZ());
- if(flipped){
- box.resize(v.getX(), -1*v.getY(), v.getZ());
- } else {
- box.resize(v.getX(), v.getY(), v.getZ());
- }
- }
+ for(Vertex v:vertices){
+ verticeTxtAttr.putf(v.getX());
+ if(flipped){
+ verticeTxtAttr.putf(-1*v.getY());
+ } else {
+ verticeTxtAttr.putf(v.getY());
+ }
+ verticeTxtAttr.putf(v.getZ());
+ if(flipped){
+ box.resize(v.getX(), -1*v.getY(), v.getZ());
+ } else {
+ box.resize(v.getX(), v.getY(), v.getZ());
+ }
+ }
verticeTxtAttr.seal(gl, true);
-
+
texCoordTxtAttr = GLArrayDataServer.createGLSL(gl, Region.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT, false,
vertices.size(), GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER);
texCoordTxtAttr.setLocation(Region.TEXCOORD_ATTR_IDX);
- for(Vertex v:vertices){
- float[] tex = v.getTexCoord();
- texCoordTxtAttr.putf(tex[0]);
- texCoordTxtAttr.putf(tex[1]);
- }
+ for(Vertex v:vertices){
+ float[] tex = v.getTexCoord();
+ texCoordTxtAttr.putf(tex[0]);
+ texCoordTxtAttr.putf(tex[1]);
+ }
texCoordTxtAttr.seal(gl, true);
// leave the buffers enabled for subsequent render call
- dirty = false;
- }
-
- public void render(PMVMatrix matrix, int vp_width, int vp_height, int width){
+ dirty = false;
+ }
+
+ public void render(PMVMatrix matrix, int vp_width, int vp_height, int width){
GL2ES2 gl = context.getGL().getGL2ES2();
- if(null == matrix || vp_width <=0 || vp_height <= 0 || width <= 0){
- renderRegion(gl);
- } else {
- if(width != tex_width_c){
+ if(null == matrix || vp_width <=0 || vp_height <= 0 || width <= 0){
+ renderRegion(gl);
+ } else {
+ if(width != tex_width_c){
renderRegion2FBO(gl, matrix, width);
setupBBox2FboAttr(gl);
- }
-// System.out.println("Scale: " + matrix.glGetMatrixf().get(1+4*3) +" " + matrix.glGetMatrixf().get(2+4*3));
- renderFBO(gl, matrix, vp_width, vp_height);
- }
- }
-
- private void renderFBO(GL2ES2 gl, PMVMatrix matrix, int width, int hight) {
- gl.glViewport(0, 0, width, hight);
- if(!st.glUniform(gl, new GLUniformData("mgl_PMVMatrix", 4, 4, matrix.glGetPMvMatrixf()))){
- System.out.println("Cnt set tex based mat");
- }
- gl.glEnable(GL2ES2.GL_TEXTURE_2D);
- gl.glActiveTexture(GL2ES2.GL_TEXTURE0);
- fbo.use(gl);
-
- st.glUniform(gl, new GLUniformData("texture", fbo.getTextureName()));
- int loc = gl.glGetUniformLocation(st.shaderProgram().program(), "texture");
- gl.glUniform1i(loc, 0);
-
-
+ }
+// System.out.println("Scale: " + matrix.glGetMatrixf().get(1+4*3) +" " + matrix.glGetMatrixf().get(2+4*3));
+ renderFBO(gl, matrix, vp_width, vp_height);
+ }
+ }
+
+ private void renderFBO(GL2ES2 gl, PMVMatrix matrix, int width, int hight) {
+ gl.glViewport(0, 0, width, hight);
+ if(!st.glUniform(gl, new GLUniformData("mgl_PMVMatrix", 4, 4, matrix.glGetPMvMatrixf()))){
+ System.out.println("Cnt set tex based mat");
+ }
+ gl.glEnable(GL2ES2.GL_TEXTURE_2D);
+ gl.glActiveTexture(GL2ES2.GL_TEXTURE0);
+ fbo.use(gl);
+
+ st.glUniform(gl, new GLUniformData("texture", fbo.getTextureName()));
+ int loc = gl.glGetUniformLocation(st.shaderProgram().program(), "texture");
+ gl.glUniform1i(loc, 0);
+
+
verticeFboAttr.enableBuffer(gl, true);
texCoordFboAttr.enableBuffer(gl, true);
indicesFbo.enableBuffer(gl, true);
gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesFbo.getElementNumber() * indicesFbo.getComponentNumber(), GL2ES2.GL_UNSIGNED_SHORT, 0);
-
+
verticeFboAttr.enableBuffer(gl, false);
texCoordFboAttr.enableBuffer(gl, false);
indicesFbo.enableBuffer(gl, false);
- }
-
- private void setupBBox2FboAttr(GL2ES2 gl){
+ }
+
+ private void setupBBox2FboAttr(GL2ES2 gl){
verticeFboAttr.seal(gl, false);
verticeFboAttr.rewind();
- verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]);
- verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]);
- verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]);
- verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]);
-
+ verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]);
+ verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]);
+ verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]);
+ verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]);
+
verticeFboAttr.seal(gl, true);
- }
-
- private void renderRegion2FBO(GL2ES2 gl, PMVMatrix m, int tex_width){
- tex_width_c = tex_width;
- tex_height_c = (int)(tex_width_c*box.getHeight()/box.getWidth());
-
+ }
+
+ private void renderRegion2FBO(GL2ES2 gl, PMVMatrix m, int tex_width){
+ tex_width_c = tex_width;
+ tex_height_c = (int)(tex_width_c*box.getHeight()/box.getWidth());
+
// System.out.println("FBO Size: "+tex_width+" -> "+tex_height_c+"x"+tex_width_c);
// System.out.println("FBO Scale: " + m.glGetMatrixf().get(0) +" " + m.glGetMatrixf().get(5));
@@ -245,79 +245,79 @@ public class VBORegion2PES2 implements Region {
if(null == fbo) {
fbo = new FBObject(tex_width_c, tex_height_c);
// FIXME: shall not use bilinear, due to own AA ? However, w/o bilinear result is not smooth
- fbo.init(gl, GL2ES2.GL_LINEAR, GL2ES2.GL_LINEAR, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE);
- // fbo.init(gl, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE);
- fbo.attachDepthBuffer(gl, GL.GL_DEPTH_COMPONENT16); // FIXME: or shall we use 24 or 32 bit depth ?
+ fbo.init(gl, GL2ES2.GL_LINEAR, GL2ES2.GL_LINEAR, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE);
+ // fbo.init(gl, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE);
+ fbo.attachDepthBuffer(gl, GL.GL_DEPTH_COMPONENT16); // FIXME: or shall we use 24 or 32 bit depth ?
} else {
fbo.bind(gl);
}
-
- //render texture
- PMVMatrix tex_matrix = new PMVMatrix();
- gl.glViewport(0, 0, tex_width_c, tex_height_c);
- tex_matrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
- tex_matrix.glLoadIdentity();
- tex_matrix.glOrthof(box.getLow()[0], box.getHigh()[0], box.getLow()[1], box.getHigh()[1], -1, 1);
-
- if(!st.glUniform(gl, new GLUniformData("mgl_PMVMatrix", 4, 4, tex_matrix.glGetPMvMatrixf()))){
- System.out.println("Cnt set tex based mat");
- }
-
- gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
- gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT | GL2ES2.GL_DEPTH_BUFFER_BIT);
- renderRegion(gl);
+
+ //render texture
+ PMVMatrix tex_matrix = new PMVMatrix();
+ gl.glViewport(0, 0, tex_width_c, tex_height_c);
+ tex_matrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+ tex_matrix.glLoadIdentity();
+ tex_matrix.glOrthof(box.getLow()[0], box.getHigh()[0], box.getLow()[1], box.getHigh()[1], -1, 1);
+
+ if(!st.glUniform(gl, new GLUniformData("mgl_PMVMatrix", 4, 4, tex_matrix.glGetPMvMatrixf()))){
+ System.out.println("Cnt set tex based mat");
+ }
+
+ gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT | GL2ES2.GL_DEPTH_BUFFER_BIT);
+ renderRegion(gl);
- fbo.unbind(gl);
- }
-
- private void renderRegion(GL2ES2 gl) {
+ fbo.unbind(gl);
+ }
+
+ private void renderRegion(GL2ES2 gl) {
verticeTxtAttr.enableBuffer(gl, true);
texCoordTxtAttr.enableBuffer(gl, true);
indicesTxt.enableBuffer(gl, true);
-
- gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesTxt.getElementNumber() * indicesTxt.getComponentNumber(), GL2ES2.GL_UNSIGNED_SHORT, 0);
-
+
+ gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesTxt.getElementNumber() * indicesTxt.getComponentNumber(), GL2ES2.GL_UNSIGNED_SHORT, 0);
+
verticeTxtAttr.enableBuffer(gl, false);
texCoordTxtAttr.enableBuffer(gl, false);
indicesTxt.enableBuffer(gl, false);
- }
-
- public void addTriangles(ArrayList<Triangle> tris) {
- triangles.addAll(tris);
- dirty = true;
- }
-
- public int getNumVertices(){
- return numVertices;
- }
-
- public void addVertices(ArrayList<Vertex> verts){
- vertices.addAll(verts);
- numVertices = vertices.size();
- dirty = true;
- }
-
- public boolean isDirty(){
- return dirty;
- }
-
- public void destroy() {
- if(DEBUG) {
- System.err.println("VBORegion2PES2 Destroy: " + this);
- }
- GL2ES2 gl = context.getGL().getGL2ES2();
- destroyFbo(gl);
+ }
+
+ public void addTriangles(ArrayList<Triangle> tris) {
+ triangles.addAll(tris);
+ dirty = true;
+ }
+
+ public int getNumVertices(){
+ return numVertices;
+ }
+
+ public void addVertices(ArrayList<Vertex> verts){
+ vertices.addAll(verts);
+ numVertices = vertices.size();
+ dirty = true;
+ }
+
+ public boolean isDirty(){
+ return dirty;
+ }
+
+ public void destroy() {
+ if(DEBUG) {
+ System.err.println("VBORegion2PES2 Destroy: " + this);
+ }
+ GL2ES2 gl = context.getGL().getGL2ES2();
+ destroyFbo(gl);
destroyTxtAttr(gl);
destroyFboAttr(gl);
triangles.clear();
vertices.clear();
- }
- final void destroyFbo(GL2ES2 gl) {
+ }
+ final void destroyFbo(GL2ES2 gl) {
if(null != fbo) {
fbo.destroy(gl);
fbo = null;
- }
- }
+ }
+ }
final void destroyTxtAttr(GL2ES2 gl) {
if(null != verticeTxtAttr) {
verticeTxtAttr.destroy(gl);
@@ -331,7 +331,7 @@ public class VBORegion2PES2 implements Region {
indicesTxt.destroy(gl);
indicesTxt = null;
}
- }
+ }
final void destroyFboAttr(GL2ES2 gl) {
if(null != verticeFboAttr) {
verticeFboAttr.destroy(gl);
@@ -347,15 +347,15 @@ public class VBORegion2PES2 implements Region {
}
}
- public boolean isFlipped() {
- return flipped;
- }
+ public boolean isFlipped() {
+ return flipped;
+ }
- public void setFlipped(boolean flipped) {
- this.flipped = flipped;
- }
-
- public AABBox getBounds(){
- return box;
- }
+ public void setFlipped(boolean flipped) {
+ this.flipped = flipped;
+ }
+
+ public AABBox getBounds(){
+ return box;
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
index 0d68be8..83cd6b8 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
@@ -41,143 +41,143 @@ import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.PMVMatrix;
public class VBORegionSPES2 implements Region {
- private int numVertices = 0;
-
- private ArrayList<Triangle> triangles = new ArrayList<Triangle>();
- private ArrayList<Vertex> vertices = new ArrayList<Vertex>();
- private GLArrayDataServer verticeAttr = null;
- private GLArrayDataServer texCoordAttr = null;
- private GLArrayDataServer indices = null;
-
- private GLContext context;
-
- private boolean flipped = false;
- private boolean dirty = false;
-
- private AABBox box = null;
-
- public VBORegionSPES2(GLContext context){
- this.context =context;
- }
-
- public void update(){
- box = new AABBox();
- GL2ES2 gl = context.getGL().getGL2ES2();
-
+ private int numVertices = 0;
+
+ private ArrayList<Triangle> triangles = new ArrayList<Triangle>();
+ private ArrayList<Vertex> vertices = new ArrayList<Vertex>();
+ private GLArrayDataServer verticeAttr = null;
+ private GLArrayDataServer texCoordAttr = null;
+ private GLArrayDataServer indices = null;
+
+ private GLContext context;
+
+ private boolean flipped = false;
+ private boolean dirty = false;
+
+ private AABBox box = null;
+
+ public VBORegionSPES2(GLContext context){
+ this.context =context;
+ }
+
+ public void update(){
+ box = new AABBox();
+ GL2ES2 gl = context.getGL().getGL2ES2();
+
destroy(gl);
indices = GLArrayDataServer.createGLSL(gl, null, 3, GL2ES2.GL_SHORT, false,
triangles.size(), GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
- for(Triangle t:triangles){
- final Vertex[] t_vertices = t.getVertices();
-
- if(t_vertices[0].getId() == Integer.MAX_VALUE){
- t_vertices[0].setId(numVertices++);
- t_vertices[1].setId(numVertices++);
- t_vertices[2].setId(numVertices++);
-
- vertices.add(t.getVertices()[0]);
- vertices.add(t.getVertices()[1]);
- vertices.add(t.getVertices()[2]);
+ for(Triangle t:triangles){
+ final Vertex[] t_vertices = t.getVertices();
+
+ if(t_vertices[0].getId() == Integer.MAX_VALUE){
+ t_vertices[0].setId(numVertices++);
+ t_vertices[1].setId(numVertices++);
+ t_vertices[2].setId(numVertices++);
+
+ vertices.add(t.getVertices()[0]);
+ vertices.add(t.getVertices()[1]);
+ vertices.add(t.getVertices()[2]);
- indices.puts((short) t.getVertices()[0].getId());
- indices.puts((short) t.getVertices()[1].getId());
- indices.puts((short) t.getVertices()[2].getId());
- }
- else{
- Vertex v1 = t_vertices[0];
- Vertex v2 = t_vertices[1];
- Vertex v3 = t_vertices[2];
-
- indices.puts((short) v1.getId());
- indices.puts((short) v2.getId());
- indices.puts((short) v3.getId());
- }
- }
+ indices.puts((short) t.getVertices()[0].getId());
+ indices.puts((short) t.getVertices()[1].getId());
+ indices.puts((short) t.getVertices()[2].getId());
+ }
+ else{
+ Vertex v1 = t_vertices[0];
+ Vertex v2 = t_vertices[1];
+ Vertex v3 = t_vertices[2];
+
+ indices.puts((short) v1.getId());
+ indices.puts((short) v2.getId());
+ indices.puts((short) v3.getId());
+ }
+ }
indices.seal(gl, true);
-
- verticeAttr = GLArrayDataServer.createGLSL(gl, Region.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, false,
- vertices.size(), GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER);
- verticeAttr.setLocation(Region.VERTEX_ATTR_IDX);
- for(Vertex v:vertices){
-
- if(flipped){
- verticeAttr.putf(v.getX());
- verticeAttr.putf(-1*v.getY());
- verticeAttr.putf(v.getZ());
-
- box.resize(v.getX(),-1*v.getY(),v.getZ());
- }
- else{
- verticeAttr.putf(v.getX());
- verticeAttr.putf(v.getY());
- verticeAttr.putf(v.getZ());
-
- box.resize(v.getX(),v.getY(),v.getZ());
- }
- }
- verticeAttr.seal(gl, true);
+
+ verticeAttr = GLArrayDataServer.createGLSL(gl, Region.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, false,
+ vertices.size(), GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER);
+ verticeAttr.setLocation(Region.VERTEX_ATTR_IDX);
+ for(Vertex v:vertices){
+
+ if(flipped){
+ verticeAttr.putf(v.getX());
+ verticeAttr.putf(-1*v.getY());
+ verticeAttr.putf(v.getZ());
+
+ box.resize(v.getX(),-1*v.getY(),v.getZ());
+ }
+ else{
+ verticeAttr.putf(v.getX());
+ verticeAttr.putf(v.getY());
+ verticeAttr.putf(v.getZ());
+
+ box.resize(v.getX(),v.getY(),v.getZ());
+ }
+ }
+ verticeAttr.seal(gl, true);
texCoordAttr = GLArrayDataServer.createGLSL(gl, Region.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT, false,
vertices.size(), GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER);
texCoordAttr.setLocation(Region.TEXCOORD_ATTR_IDX);
- for(Vertex v:vertices){
- float[] tex = v.getTexCoord();
- texCoordAttr.putf(tex[0]);
- texCoordAttr.putf(tex[1]);
- }
- texCoordAttr.seal(gl, true);
+ for(Vertex v:vertices){
+ float[] tex = v.getTexCoord();
+ texCoordAttr.putf(tex[0]);
+ texCoordAttr.putf(tex[1]);
+ }
+ texCoordAttr.seal(gl, true);
verticeAttr.enableBuffer(gl, false);
texCoordAttr.enableBuffer(gl, false);
indices.enableBuffer(gl, false);
- dirty = false;
- }
-
- private void render() {
- GL2ES2 gl = context.getGL().getGL2ES2();
+ dirty = false;
+ }
+
+ private void render() {
+ GL2ES2 gl = context.getGL().getGL2ES2();
verticeAttr.enableBuffer(gl, true);
texCoordAttr.enableBuffer(gl, true);
indices.enableBuffer(gl, true);
-
- gl.glDrawElements(GL2ES2.GL_TRIANGLES, indices.getElementNumber() * indices.getComponentNumber(), GL2ES2.GL_UNSIGNED_SHORT, 0);
-
+
+ gl.glDrawElements(GL2ES2.GL_TRIANGLES, indices.getElementNumber() * indices.getComponentNumber(), GL2ES2.GL_UNSIGNED_SHORT, 0);
+
verticeAttr.enableBuffer(gl, false);
texCoordAttr.enableBuffer(gl, false);
indices.enableBuffer(gl, false);
- }
-
- public void render(PMVMatrix matrix, int vp_width, int vp_height, int width){
- render();
- }
-
- public void addTriangles(ArrayList<Triangle> tris) {
- triangles.addAll(tris);
- dirty = true;
- }
-
- public int getNumVertices(){
- return numVertices;
- }
-
- public void addVertices(ArrayList<Vertex> verts){
- vertices.addAll(verts);
- numVertices = vertices.size();
- dirty = true;
- }
-
- public boolean isDirty(){
- return dirty;
- }
-
- public void destroy() {
- GL2ES2 gl = context.getGL().getGL2ES2();
- destroy(gl);
- }
-
- final void destroy(GL2ES2 gl) {
+ }
+
+ public void render(PMVMatrix matrix, int vp_width, int vp_height, int width){
+ render();
+ }
+
+ public void addTriangles(ArrayList<Triangle> tris) {
+ triangles.addAll(tris);
+ dirty = true;
+ }
+
+ public int getNumVertices(){
+ return numVertices;
+ }
+
+ public void addVertices(ArrayList<Vertex> verts){
+ vertices.addAll(verts);
+ numVertices = vertices.size();
+ dirty = true;
+ }
+
+ public boolean isDirty(){
+ return dirty;
+ }
+
+ public void destroy() {
+ GL2ES2 gl = context.getGL().getGL2ES2();
+ destroy(gl);
+ }
+
+ final void destroy(GL2ES2 gl) {
if(null != verticeAttr) {
verticeAttr.destroy(gl);
verticeAttr = null;
@@ -190,16 +190,16 @@ public class VBORegionSPES2 implements Region {
indices.destroy(gl);
indices = null;
}
- }
-
- public boolean isFlipped() {
- return flipped;
- }
+ }
+
+ public boolean isFlipped() {
+ return flipped;
+ }
- public void setFlipped(boolean flipped) {
- this.flipped = flipped;
- }
- public AABBox getBounds(){
- return box;
- }
+ public void setFlipped(boolean flipped) {
+ this.flipped = flipped;
+ }
+ public AABBox getBounds(){
+ return box;
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp
index 3a1ef51..166937f 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp
@@ -15,81 +15,81 @@ vec4 weights = vec4(0.075, 0.06, 0.045, 0.025);
void main (void)
{
- vec2 rtex = vec2(abs(v_texCoord.x),abs(v_texCoord.y));
- vec3 c = g_color;
-
- float alpha = 0.0;
-
- if((v_texCoord.x == 0.0) && (v_texCoord.y == 0.0)){
- alpha = g_alpha;
- }
- else if((v_texCoord.x >= 5.0)){
- vec2 dfx = dFdx(v_texCoord);
- vec2 dfy = dFdy(v_texCoord);
-
- vec2 size = 1.0/textureSize(texture,0); //version 130
- rtex -= 5.0;
- vec4 t = texture2D(texture, rtex)* 0.18;
+ vec2 rtex = vec2(abs(v_texCoord.x),abs(v_texCoord.y));
+ vec3 c = g_color;
+
+ float alpha = 0.0;
+
+ if((v_texCoord.x == 0.0) && (v_texCoord.y == 0.0)){
+ alpha = g_alpha;
+ }
+ else if((v_texCoord.x >= 5.0)){
+ vec2 dfx = dFdx(v_texCoord);
+ vec2 dfy = dFdy(v_texCoord);
+
+ vec2 size = 1.0/textureSize(texture,0); //version 130
+ rtex -= 5.0;
+ vec4 t = texture2D(texture, rtex)* 0.18;
- t += texture2D(texture, rtex + size*(vec2(1, 0)))*weights.x;
- t += texture2D(texture, rtex - size*(vec2(1, 0)))*weights.x;
- t += texture2D(texture, rtex + size*(vec2(0, 1)))*weights.x;
- t += texture2D(texture, rtex - size*(vec2(0, 1)))*weights.x;
-
- t += texture2D(texture, rtex + 2.0*size*(vec2(1, 0))) *weights.y;
- t += texture2D(texture, rtex - 2.0*size*(vec2(1, 0)))*weights.y;
- t += texture2D(texture, rtex + 2.0*size*(vec2(0, 1)))*weights.y;
- t += texture2D(texture, rtex - 2.0*size*(vec2(0, 1)))*weights.y;
-
- t += texture2D(texture, rtex + 3.0*size*(vec2(1, 0))) *weights.z;
- t += texture2D(texture, rtex - 3.0*size*(vec2(1, 0)))*weights.z;
- t += texture2D(texture, rtex + 3.0*size*(vec2(0, 1)))*weights.z;
- t += texture2D(texture, rtex - 3.0*size*(vec2(0, 1)))*weights.z;
-
- t += texture2D(texture, rtex + 4.0*size*(vec2(1, 0))) *weights.w;
- t += texture2D(texture, rtex - 4.0*size*(vec2(1, 0)))*weights.w;
- t += texture2D(texture, rtex + 4.0*size*(vec2(0, 1)))*weights.w;
- t += texture2D(texture, rtex - 4.0*size*(vec2(0, 1)))*weights.w;
-
- if(t.w == 0.0){
- discard;
- }
-
- c = t.xyz;
- alpha = g_alpha* t.w;
- }
- ///////////////////////////////////////////////////////////
- else if ((v_texCoord.x > 0.0) && (rtex.y > 0.0 || rtex.x == 1.0)){
- vec2 dtx = dFdx(rtex);
- vec2 dty = dFdy(rtex);
-
- rtex.y -= 0.1;
-
- if(rtex.y < 0.0) {
- if(v_texCoord.y < 0.0)
- discard;
- else{
- rtex.y = 0.0;
- }
- }
-
- 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));
- float d = position/(length(f));
+ t += texture2D(texture, rtex + size*(vec2(1, 0)))*weights.x;
+ t += texture2D(texture, rtex - size*(vec2(1, 0)))*weights.x;
+ t += texture2D(texture, rtex + size*(vec2(0, 1)))*weights.x;
+ t += texture2D(texture, rtex - size*(vec2(0, 1)))*weights.x;
+
+ t += texture2D(texture, rtex + 2.0*size*(vec2(1, 0))) *weights.y;
+ t += texture2D(texture, rtex - 2.0*size*(vec2(1, 0)))*weights.y;
+ t += texture2D(texture, rtex + 2.0*size*(vec2(0, 1)))*weights.y;
+ t += texture2D(texture, rtex - 2.0*size*(vec2(0, 1)))*weights.y;
+
+ t += texture2D(texture, rtex + 3.0*size*(vec2(1, 0))) *weights.z;
+ t += texture2D(texture, rtex - 3.0*size*(vec2(1, 0)))*weights.z;
+ t += texture2D(texture, rtex + 3.0*size*(vec2(0, 1)))*weights.z;
+ t += texture2D(texture, rtex - 3.0*size*(vec2(0, 1)))*weights.z;
+
+ t += texture2D(texture, rtex + 4.0*size*(vec2(1, 0))) *weights.w;
+ t += texture2D(texture, rtex - 4.0*size*(vec2(1, 0)))*weights.w;
+ t += texture2D(texture, rtex + 4.0*size*(vec2(0, 1)))*weights.w;
+ t += texture2D(texture, rtex - 4.0*size*(vec2(0, 1)))*weights.w;
+
+ if(t.w == 0.0){
+ discard;
+ }
+
+ c = t.xyz;
+ alpha = g_alpha* t.w;
+ }
+ ///////////////////////////////////////////////////////////
+ else if ((v_texCoord.x > 0.0) && (rtex.y > 0.0 || rtex.x == 1.0)){
+ vec2 dtx = dFdx(rtex);
+ vec2 dty = dFdy(rtex);
+
+ rtex.y -= 0.1;
+
+ if(rtex.y < 0.0) {
+ if(v_texCoord.y < 0.0)
+ discard;
+ else{
+ rtex.y = 0.0;
+ }
+ }
+
+ 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));
+ float d = position/(length(f));
- float a = (0.5 - d * sign(v_texCoord.y));
-
- if (a >= 1.0) {
- alpha = g_alpha;
- }
- else if (a <= 0.0) {
- alpha = 0.0;//discard;
- }
- else {
- alpha = g_alpha*a;
- mix(b_color,g_color, a);
- }
- }
-
+ float a = (0.5 - d * sign(v_texCoord.y));
+
+ if (a >= 1.0) {
+ alpha = g_alpha;
+ }
+ else if (a <= 0.0) {
+ alpha = 0.0;//discard;
+ }
+ else {
+ alpha = g_alpha*a;
+ mix(b_color,g_color, a);
+ }
+ }
+
gl_FragColor = vec4(c, alpha);
}
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java b/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java
index 5dae296..a0d1923 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java
@@ -33,49 +33,49 @@ import com.jogamp.graph.geom.Outline;
import com.jogamp.graph.geom.Vertex;
public class GraphOutline {
- final private Outline outline;
- final private ArrayList<GraphVertex> controlpoints = new ArrayList<GraphVertex>(3);
-
- public GraphOutline(){
- this.outline = new Outline();
- }
-
- /**Create a control polyline of control vertices
- * the curve pieces can be identified by onCurve flag
- * of each cp the control polyline is open by default
- */
- public GraphOutline(Outline ol){
- this.outline = ol;
- ArrayList<Vertex> vertices = this.outline.getVertices();
- for(Vertex v:vertices){
- this.controlpoints.add(new GraphVertex(v));
- }
- }
+ final private Outline outline;
+ final private ArrayList<GraphVertex> controlpoints = new ArrayList<GraphVertex>(3);
+
+ public GraphOutline(){
+ this.outline = new Outline();
+ }
+
+ /**Create a control polyline of control vertices
+ * the curve pieces can be identified by onCurve flag
+ * of each cp the control polyline is open by default
+ */
+ public GraphOutline(Outline ol){
+ this.outline = ol;
+ ArrayList<Vertex> vertices = this.outline.getVertices();
+ for(Vertex v:vertices){
+ this.controlpoints.add(new GraphVertex(v));
+ }
+ }
- public Outline getOutline() {
- return outline;
- }
+ public Outline getOutline() {
+ return outline;
+ }
- /*public void setOutline(Outline<T> outline) {
- this.outline = outline;
- }*/
-
+ /*public void setOutline(Outline<T> outline) {
+ this.outline = outline;
+ }*/
+
- public ArrayList<GraphVertex> getGraphPoint() {
- return controlpoints;
- }
-
- public ArrayList<Vertex> getPoints() {
- return outline.getVertices();
- }
+ public ArrayList<GraphVertex> getGraphPoint() {
+ return controlpoints;
+ }
+
+ public ArrayList<Vertex> getPoints() {
+ return outline.getVertices();
+ }
- /*public void setControlpoints(ArrayList<GraphPoint<T>> controlpoints) {
- this.controlpoints = controlpoints;
- }*/
+ /*public void setControlpoints(ArrayList<GraphPoint<T>> controlpoints) {
+ this.controlpoints = controlpoints;
+ }*/
- public void addVertex(GraphVertex v) {
- controlpoints.add(v);
- outline.addVertex(v.getPoint());
- }
-
+ public void addVertex(GraphVertex v) {
+ controlpoints.add(v);
+ outline.addVertex(v.getPoint());
+ }
+
}
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java b/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java
index b9f95a0..5efe57c 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java
@@ -32,89 +32,89 @@ import java.util.ArrayList;
import com.jogamp.graph.geom.Vertex;
public class GraphVertex {
- private Vertex point;
- private ArrayList<HEdge> edges = null;
- private boolean boundaryContained = false;
-
- public GraphVertex(Vertex point) {
- this.point = point;
- }
+ private Vertex point;
+ private ArrayList<HEdge> edges = null;
+ private boolean boundaryContained = false;
+
+ public GraphVertex(Vertex point) {
+ this.point = point;
+ }
- public Vertex getPoint() {
- return point;
- }
-
- public float getX(){
- return point.getX();
- }
-
- public float getY(){
- return point.getY();
- }
-
- public float getZ(){
- return point.getZ();
- }
- public float[] getCoord() {
- return point.getCoord();
- }
+ public Vertex getPoint() {
+ return point;
+ }
+
+ public float getX(){
+ return point.getX();
+ }
+
+ public float getY(){
+ return point.getY();
+ }
+
+ public float getZ(){
+ return point.getZ();
+ }
+ public float[] getCoord() {
+ return point.getCoord();
+ }
- public void setPoint(Vertex point) {
- this.point = point;
- }
+ public void setPoint(Vertex point) {
+ this.point = point;
+ }
- public ArrayList<HEdge> getEdges() {
- return edges;
- }
+ public ArrayList<HEdge> getEdges() {
+ return edges;
+ }
- public void setEdges(ArrayList<HEdge> edges) {
- this.edges = edges;
- }
-
- public void addEdge(HEdge edge){
- if(edges == null){
- edges = new ArrayList<HEdge>();
- }
- edges.add(edge);
- }
- public void removeEdge(HEdge edge){
- if(edges == null)
- return;
- edges.remove(edge);
- if(edges.size() == 0){
- edges = null;
- }
- }
- public HEdge findNextEdge(GraphVertex nextVert){
- for(HEdge e:edges){
- if(e.getNext().getGraphPoint() == nextVert){
- return e;
- }
- }
- return null;
- }
- public HEdge findBoundEdge(){
- for(HEdge e:edges){
- if((e.getType() == HEdge.BOUNDARY) || (e.getType() == HEdge.HOLE)){
- return e;
- }
- }
- return null;
- }
- public HEdge findPrevEdge(GraphVertex prevVert){
- for(HEdge e:edges){
- if(e.getPrev().getGraphPoint() == prevVert){
- return e;
- }
- }
- return null;
- }
-
- public boolean isBoundaryContained() {
- return boundaryContained;
- }
+ public void setEdges(ArrayList<HEdge> edges) {
+ this.edges = edges;
+ }
+
+ public void addEdge(HEdge edge){
+ if(edges == null){
+ edges = new ArrayList<HEdge>();
+ }
+ edges.add(edge);
+ }
+ public void removeEdge(HEdge edge){
+ if(edges == null)
+ return;
+ edges.remove(edge);
+ if(edges.size() == 0){
+ edges = null;
+ }
+ }
+ public HEdge findNextEdge(GraphVertex nextVert){
+ for(HEdge e:edges){
+ if(e.getNext().getGraphPoint() == nextVert){
+ return e;
+ }
+ }
+ return null;
+ }
+ public HEdge findBoundEdge(){
+ for(HEdge e:edges){
+ if((e.getType() == HEdge.BOUNDARY) || (e.getType() == HEdge.HOLE)){
+ return e;
+ }
+ }
+ return null;
+ }
+ public HEdge findPrevEdge(GraphVertex prevVert){
+ for(HEdge e:edges){
+ if(e.getPrev().getGraphPoint() == prevVert){
+ return e;
+ }
+ }
+ return null;
+ }
+
+ public boolean isBoundaryContained() {
+ return boundaryContained;
+ }
- public void setBoundaryContained(boolean boundaryContained) {
- this.boundaryContained = boundaryContained;
- }
+ public void setBoundaryContained(boolean boundaryContained) {
+ this.boundaryContained = boundaryContained;
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java b/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java
index d1bcc6e..4d29a81 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java
@@ -32,99 +32,99 @@ import com.jogamp.graph.geom.Triangle;
public class HEdge {
- public static int BOUNDARY = 3;
- public static int INNER = 1;
- public static int HOLE = 2;
-
- private GraphVertex vert;
- private HEdge prev = null;
- private HEdge next = null;
- private HEdge sibling = null;
- private int type = BOUNDARY;
- private Triangle triangle = null;
-
- public HEdge(GraphVertex vert, int type) {
- this.vert = vert;
- this.type = type;
- }
-
- public HEdge(GraphVertex vert, HEdge prev, HEdge next, HEdge sibling, int type) {
- this.vert = vert;
- this.prev = prev;
- this.next = next;
- this.sibling = sibling;
- this.type = type;
- }
-
- public HEdge(GraphVertex vert, HEdge prev, HEdge next, HEdge sibling, int type, Triangle triangle) {
- this.vert = vert;
- this.prev = prev;
- this.next = next;
- this.sibling = sibling;
- this.type = type;
- this.triangle = triangle;
- }
-
- public GraphVertex getGraphPoint() {
- return vert;
- }
-
- public void setVert(GraphVertex vert) {
- this.vert = vert;
- }
-
- public HEdge getPrev() {
- return prev;
- }
-
- public void setPrev(HEdge prev) {
- this.prev = prev;
- }
-
- public HEdge getNext() {
- return next;
- }
-
- public void setNext(HEdge next) {
- this.next = next;
- }
-
- public HEdge getSibling() {
- return sibling;
- }
-
- public void setSibling(HEdge sibling) {
- this.sibling = sibling;
- }
-
- public int getType() {
- return type;
- }
-
- public void setType(int type) {
- this.type = type;
- }
-
- public Triangle getTriangle() {
- return triangle;
- }
-
- public void setTriangle(Triangle triangle) {
- this.triangle = triangle;
- }
-
- public static <T extends Vertex> void connect(HEdge first, HEdge next){
- first.setNext(next);
- next.setPrev(first);
- }
-
- public static <T extends Vertex> void makeSiblings(HEdge first, HEdge second){
- first.setSibling(second);
- second.setSibling(first);
- }
-
- public boolean vertexOnCurveVertex(){
- return vert.getPoint().isOnCurve();
- }
-
+ public static int BOUNDARY = 3;
+ public static int INNER = 1;
+ public static int HOLE = 2;
+
+ private GraphVertex vert;
+ private HEdge prev = null;
+ private HEdge next = null;
+ private HEdge sibling = null;
+ private int type = BOUNDARY;
+ private Triangle triangle = null;
+
+ public HEdge(GraphVertex vert, int type) {
+ this.vert = vert;
+ this.type = type;
+ }
+
+ public HEdge(GraphVertex vert, HEdge prev, HEdge next, HEdge sibling, int type) {
+ this.vert = vert;
+ this.prev = prev;
+ this.next = next;
+ this.sibling = sibling;
+ this.type = type;
+ }
+
+ public HEdge(GraphVertex vert, HEdge prev, HEdge next, HEdge sibling, int type, Triangle triangle) {
+ this.vert = vert;
+ this.prev = prev;
+ this.next = next;
+ this.sibling = sibling;
+ this.type = type;
+ this.triangle = triangle;
+ }
+
+ public GraphVertex getGraphPoint() {
+ return vert;
+ }
+
+ public void setVert(GraphVertex vert) {
+ this.vert = vert;
+ }
+
+ public HEdge getPrev() {
+ return prev;
+ }
+
+ public void setPrev(HEdge prev) {
+ this.prev = prev;
+ }
+
+ public HEdge getNext() {
+ return next;
+ }
+
+ public void setNext(HEdge next) {
+ this.next = next;
+ }
+
+ public HEdge getSibling() {
+ return sibling;
+ }
+
+ public void setSibling(HEdge sibling) {
+ this.sibling = sibling;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public void setType(int type) {
+ this.type = type;
+ }
+
+ public Triangle getTriangle() {
+ return triangle;
+ }
+
+ public void setTriangle(Triangle triangle) {
+ this.triangle = triangle;
+ }
+
+ public static <T extends Vertex> void connect(HEdge first, HEdge next){
+ first.setNext(next);
+ next.setPrev(first);
+ }
+
+ public static <T extends Vertex> void makeSiblings(HEdge first, HEdge second){
+ first.setSibling(second);
+ second.setSibling(first);
+ }
+
+ public boolean vertexOnCurveVertex(){
+ return vert.getPoint().isOnCurve();
+ }
+
}
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
index fd7736a..9e29d39 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
@@ -36,338 +36,338 @@ import com.jogamp.graph.geom.Triangle;
import com.jogamp.graph.math.VectorUtil;
public class Loop {
- private HEdge root = null;
- private AABBox box = new AABBox();
- private GraphOutline initialOutline = null;
-
- public Loop(GraphOutline polyline, int direction){
- initialOutline = polyline;
- this.root = initFromPolyline(initialOutline, direction);
- }
-
- public HEdge getHEdge(){
- return root;
- }
-
- public Triangle cut(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;
- }
- HEdge prev = root.getPrev();
- HEdge next1 = root.getNext();
-
- 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();
-
- HEdge v3Edge = new HEdge(v3, HEdge.INNER);
-
- HEdge.connect(v3Edge, root);
- HEdge.connect(next1, v3Edge);
-
- HEdge v3EdgeSib = v3Edge.getSibling();
- if(v3EdgeSib == null){
- v3EdgeSib = new HEdge(v3Edge.getNext().getGraphPoint(), HEdge.INNER);
- HEdge.makeSiblings(v3Edge, v3EdgeSib);
- }
-
- HEdge.connect(prev, v3EdgeSib);
- HEdge.connect(v3EdgeSib, next2);
-
- Triangle t = createTriangle(v1.getPoint(), v2.getPoint(), v3.getPoint(), root);
- this.root = next2;
- return t;
- }
-
- public boolean isSimplex(){
- return (root.getNext().getNext().getNext() == root);
- }
-
- /**Create a connected list of half edges (loop)
- * from the boundary profile
- * @param direction requested winding of edges (CCW or CW)
- */
- private HEdge initFromPolyline(GraphOutline outline, int direction){
- ArrayList<GraphVertex> vertices = outline.getGraphPoint();
-
- if(vertices.size()<3) {
- throw new IllegalArgumentException("outline's vertices < 3: " + vertices.size());
- }
- boolean isCCW = VectorUtil.ccw(vertices.get(0).getPoint(), vertices.get(1).getPoint(),
- vertices.get(2).getPoint());
- boolean invert = isCCW && (direction == VectorUtil.CW);
-
- HEdge firstEdge = null;
- HEdge lastEdge = null;
- int index =0;
- int max = vertices.size();
-
- int edgeType = HEdge.BOUNDARY;
- if(invert){
- index = vertices.size() -1;
- max = -1;
- edgeType = HEdge.HOLE;
- }
-
- while(index != max){
- GraphVertex v1 = vertices.get(index);
- box.resize(v1.getX(), v1.getY(), v1.getZ());
-
- HEdge edge = new HEdge(v1, edgeType);
-
- v1.addEdge(edge);
- if(lastEdge != null){
- lastEdge.setNext(edge);
- edge.setPrev(lastEdge);
- }
- else{
- firstEdge = edge;
- }
-
- if(!invert){
- if(index == vertices.size()-1){
- edge.setNext(firstEdge);
- firstEdge.setPrev(edge);
- }
- }
- else if (index == 0){
- edge.setNext(firstEdge);
- firstEdge.setPrev(edge);
- }
-
- lastEdge = edge;
-
- if(!invert){
- index++;
- }
- else{
- index--;
- }
- }
- return firstEdge;
- }
-
- public void addConstraintCurve(GraphOutline polyline) {
- // GraphOutline outline = new GraphOutline(polyline);
- /**needed to generate vertex references.*/
- initFromPolyline(polyline, VectorUtil.CW);
-
- GraphVertex v3 = locateClosestVertex(polyline);
- HEdge v3Edge = v3.findBoundEdge();
- HEdge v3EdgeP = v3Edge.getPrev();
- HEdge crossEdge = new HEdge(root.getGraphPoint(), HEdge.INNER);
-
- HEdge.connect(root.getPrev(), crossEdge);
- HEdge.connect(crossEdge, v3Edge);
-
- HEdge crossEdgeSib = crossEdge.getSibling();
- if(crossEdgeSib == null) {
- crossEdgeSib = new HEdge(crossEdge.getNext().getGraphPoint(), HEdge.INNER);
- HEdge.makeSiblings(crossEdge, crossEdgeSib);
- }
-
- HEdge.connect(v3EdgeP, crossEdgeSib);
- HEdge.connect(crossEdgeSib, root);
- }
-
- /** Locates the vertex and update the loops root
- * to have (root + vertex) as closest pair
- * @param polyline the control polyline
- * to search for closestvertices
- * @return the vertex that is closest to the newly set root Hedge.
- */
- private GraphVertex locateClosestVertex(GraphOutline polyline) {
- HEdge closestE = null;
- GraphVertex closestV = null;
-
- float minDistance = Float.MAX_VALUE;
- boolean inValid = false;
- ArrayList<GraphVertex> initVertices = initialOutline.getGraphPoint();
- ArrayList<GraphVertex> vertices = polyline.getGraphPoint();
-
- for(int i=0; i< initVertices.size()-1; i++){
- GraphVertex v = initVertices.get(i);
- GraphVertex nextV = initVertices.get(i+1);
- for(GraphVertex cand:vertices){
- float distance = VectorUtil.computeLength(v.getCoord(), cand.getCoord());
- if(distance < minDistance){
- for (GraphVertex vert:vertices){
- if(vert == v || vert == nextV || vert == cand)
- continue;
- inValid = VectorUtil.inCircle(v.getPoint(), nextV.getPoint(),
- cand.getPoint(), vert.getPoint());
- if(inValid){
- break;
- }
- }
- if(!inValid){
- closestV = cand;
- minDistance = distance;
- closestE = v.findBoundEdge();
- }
- }
-
- }
- }
-
- if(closestE != null){
- root = closestE;
- }
-
- return closestV;
- }
-
- private HEdge findClosestValidNeighbor(HEdge edge, boolean delaunay) {
- HEdge next = root.getNext();
-
- if(!VectorUtil.ccw(root.getGraphPoint().getPoint(), next.getGraphPoint().getPoint(),
- edge.getGraphPoint().getPoint())){
- return null;
- }
-
- HEdge candEdge = edge;
- boolean inValid = false;
-
- if(delaunay){
- Vertex cand = candEdge.getGraphPoint().getPoint();
- HEdge e = candEdge.getNext();
- while (e != candEdge){
- if(e.getGraphPoint() == root.getGraphPoint()
- || e.getGraphPoint() == next.getGraphPoint()
- || e.getGraphPoint().getPoint() == cand){
- e = e.getNext();
- continue;
- }
- inValid = VectorUtil.inCircle(root.getGraphPoint().getPoint(), next.getGraphPoint().getPoint(),
- cand, e.getGraphPoint().getPoint());
- if(inValid){
- break;
- }
- e = e.getNext();
- }
- }
- if(!inValid){
- return candEdge;
- }
- return null;
- }
-
- /** Create a triangle from the param vertices only if
- * the triangle is valid. IE not outside region.
- * @param v1 vertex 1
- * @param v2 vertex 2
- * @param v3 vertex 3
- * @param root and edge of this triangle
- * @return the triangle iff it satisfies, null otherwise
- */
- private Triangle createTriangle(Vertex v1, Vertex v2, Vertex v3, HEdge rootT){
- Triangle t = new Triangle(v1, v2, v3);
- t.setVerticesBoundary(checkVerticesBoundary(rootT));
- return t;
- }
-
- private boolean[] checkVerticesBoundary(HEdge rootT) {
- boolean[] boundary = new boolean[3];
- HEdge e1 = rootT;
- HEdge e2 = rootT.getNext();
- HEdge e3 = rootT.getNext().getNext();
-
- if(e1.getGraphPoint().isBoundaryContained()){
- boundary[0] = true;
- }
- if(e2.getGraphPoint().isBoundaryContained()){
- boundary[1] = true;
- }
- if(e3.getGraphPoint().isBoundaryContained()){
- boundary[2] = true;
- }
- return boundary;
- }
-
-
- /** Check if vertex inside the Loop
- * @param vertex the Vertex
- * @return true if the vertex is inside, false otherwise
- */
- public boolean checkInside(Vertex vertex) {
- if(!box.contains(vertex.getX(), vertex.getY(), vertex.getZ())){
- return false;
- }
-
- float[] center = box.getCenter();
-
- int hits = 0;
- HEdge current = root;
- HEdge next = root.getNext();
- while(next!= root){
- if(current.getType() == HEdge.INNER || next.getType() == HEdge.INNER){
- current = next;
- next = current.getNext();
- continue;
- }
- Vertex vert1 = current.getGraphPoint().getPoint();
- Vertex vert2 = next.getGraphPoint().getPoint();
-
- /** The ray is P0+s*D0, where P0 is the ray origin, D0 is a direction vector and s >= 0.
- * The segment is P1+t*D1, where P1 and P1+D1 are the endpoints, and 0 <= t <= 1.
- * perp(x,y) = (y,-x).
- * if Dot(perp(D1),D0) is not zero,
- * s = Dot(perp(D1),P1-P0)/Dot(perp(D1),D0)
- * t = Dot(perp(D0),P1-P0)/Dot(perp(D1),D0)
- */
-
- float[] d0 = new float[]{center[0] - vertex.getX(), center[1]-vertex.getY(),
- center[2]-vertex.getZ()};
- float[] d1 = {vert2.getX() - vert1.getX(), vert2.getY() - vert1.getY(),
- vert2.getZ() - vert1.getZ()};
-
- float[] prep_d1 = {d1[1],-1*d1[0], d1[2]};
- float[] prep_d0 = {d0[1],-1*d0[0], d0[2]};
-
- float[] p0p1 = new float[]{vert1.getX() - vertex.getX(), vert1.getY() - vertex.getY(),
- vert1.getZ() - vertex.getZ()};
-
- float dotD1D0 = VectorUtil.dot(prep_d1, d0);
- if(dotD1D0 == 0){
- /** ray parallel to segment */
- current = next;
- next = current.getNext();
- continue;
- }
-
- float s = VectorUtil.dot(prep_d1,p0p1)/dotD1D0;
- float t = VectorUtil.dot(prep_d0,p0p1)/dotD1D0;
-
- if(s >= 0 && t >= 0 && t<= 1){
- hits++;
- }
- current = next;
- next = current.getNext();
- }
-
- if(hits % 2 != 0){
- /** check if hit count is even */
- return true;
- }
- return false;
- }
-
- public int computeLoopSize(){
- int size = 0;
- HEdge e = root;
- do{
- size++;
- e = e.getNext();
- }while(e != root);
- return size;
- }
+ private HEdge root = null;
+ private AABBox box = new AABBox();
+ private GraphOutline initialOutline = null;
+
+ public Loop(GraphOutline polyline, int direction){
+ initialOutline = polyline;
+ this.root = initFromPolyline(initialOutline, direction);
+ }
+
+ public HEdge getHEdge(){
+ return root;
+ }
+
+ public Triangle cut(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;
+ }
+ HEdge prev = root.getPrev();
+ HEdge next1 = root.getNext();
+
+ 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();
+
+ HEdge v3Edge = new HEdge(v3, HEdge.INNER);
+
+ HEdge.connect(v3Edge, root);
+ HEdge.connect(next1, v3Edge);
+
+ HEdge v3EdgeSib = v3Edge.getSibling();
+ if(v3EdgeSib == null){
+ v3EdgeSib = new HEdge(v3Edge.getNext().getGraphPoint(), HEdge.INNER);
+ HEdge.makeSiblings(v3Edge, v3EdgeSib);
+ }
+
+ HEdge.connect(prev, v3EdgeSib);
+ HEdge.connect(v3EdgeSib, next2);
+
+ Triangle t = createTriangle(v1.getPoint(), v2.getPoint(), v3.getPoint(), root);
+ this.root = next2;
+ return t;
+ }
+
+ public boolean isSimplex(){
+ return (root.getNext().getNext().getNext() == root);
+ }
+
+ /**Create a connected list of half edges (loop)
+ * from the boundary profile
+ * @param direction requested winding of edges (CCW or CW)
+ */
+ private HEdge initFromPolyline(GraphOutline outline, int direction){
+ ArrayList<GraphVertex> vertices = outline.getGraphPoint();
+
+ if(vertices.size()<3) {
+ throw new IllegalArgumentException("outline's vertices < 3: " + vertices.size());
+ }
+ boolean isCCW = VectorUtil.ccw(vertices.get(0).getPoint(), vertices.get(1).getPoint(),
+ vertices.get(2).getPoint());
+ boolean invert = isCCW && (direction == VectorUtil.CW);
+
+ HEdge firstEdge = null;
+ HEdge lastEdge = null;
+ int index =0;
+ int max = vertices.size();
+
+ int edgeType = HEdge.BOUNDARY;
+ if(invert){
+ index = vertices.size() -1;
+ max = -1;
+ edgeType = HEdge.HOLE;
+ }
+
+ while(index != max){
+ GraphVertex v1 = vertices.get(index);
+ box.resize(v1.getX(), v1.getY(), v1.getZ());
+
+ HEdge edge = new HEdge(v1, edgeType);
+
+ v1.addEdge(edge);
+ if(lastEdge != null){
+ lastEdge.setNext(edge);
+ edge.setPrev(lastEdge);
+ }
+ else{
+ firstEdge = edge;
+ }
+
+ if(!invert){
+ if(index == vertices.size()-1){
+ edge.setNext(firstEdge);
+ firstEdge.setPrev(edge);
+ }
+ }
+ else if (index == 0){
+ edge.setNext(firstEdge);
+ firstEdge.setPrev(edge);
+ }
+
+ lastEdge = edge;
+
+ if(!invert){
+ index++;
+ }
+ else{
+ index--;
+ }
+ }
+ return firstEdge;
+ }
+
+ public void addConstraintCurve(GraphOutline polyline) {
+ // GraphOutline outline = new GraphOutline(polyline);
+ /**needed to generate vertex references.*/
+ initFromPolyline(polyline, VectorUtil.CW);
+
+ GraphVertex v3 = locateClosestVertex(polyline);
+ HEdge v3Edge = v3.findBoundEdge();
+ HEdge v3EdgeP = v3Edge.getPrev();
+ HEdge crossEdge = new HEdge(root.getGraphPoint(), HEdge.INNER);
+
+ HEdge.connect(root.getPrev(), crossEdge);
+ HEdge.connect(crossEdge, v3Edge);
+
+ HEdge crossEdgeSib = crossEdge.getSibling();
+ if(crossEdgeSib == null) {
+ crossEdgeSib = new HEdge(crossEdge.getNext().getGraphPoint(), HEdge.INNER);
+ HEdge.makeSiblings(crossEdge, crossEdgeSib);
+ }
+
+ HEdge.connect(v3EdgeP, crossEdgeSib);
+ HEdge.connect(crossEdgeSib, root);
+ }
+
+ /** Locates the vertex and update the loops root
+ * to have (root + vertex) as closest pair
+ * @param polyline the control polyline
+ * to search for closestvertices
+ * @return the vertex that is closest to the newly set root Hedge.
+ */
+ private GraphVertex locateClosestVertex(GraphOutline polyline) {
+ HEdge closestE = null;
+ GraphVertex closestV = null;
+
+ float minDistance = Float.MAX_VALUE;
+ boolean inValid = false;
+ ArrayList<GraphVertex> initVertices = initialOutline.getGraphPoint();
+ ArrayList<GraphVertex> vertices = polyline.getGraphPoint();
+
+ for(int i=0; i< initVertices.size()-1; i++){
+ GraphVertex v = initVertices.get(i);
+ GraphVertex nextV = initVertices.get(i+1);
+ for(GraphVertex cand:vertices){
+ float distance = VectorUtil.computeLength(v.getCoord(), cand.getCoord());
+ if(distance < minDistance){
+ for (GraphVertex vert:vertices){
+ if(vert == v || vert == nextV || vert == cand)
+ continue;
+ inValid = VectorUtil.inCircle(v.getPoint(), nextV.getPoint(),
+ cand.getPoint(), vert.getPoint());
+ if(inValid){
+ break;
+ }
+ }
+ if(!inValid){
+ closestV = cand;
+ minDistance = distance;
+ closestE = v.findBoundEdge();
+ }
+ }
+
+ }
+ }
+
+ if(closestE != null){
+ root = closestE;
+ }
+
+ return closestV;
+ }
+
+ private HEdge findClosestValidNeighbor(HEdge edge, boolean delaunay) {
+ HEdge next = root.getNext();
+
+ if(!VectorUtil.ccw(root.getGraphPoint().getPoint(), next.getGraphPoint().getPoint(),
+ edge.getGraphPoint().getPoint())){
+ return null;
+ }
+
+ HEdge candEdge = edge;
+ boolean inValid = false;
+
+ if(delaunay){
+ Vertex cand = candEdge.getGraphPoint().getPoint();
+ HEdge e = candEdge.getNext();
+ while (e != candEdge){
+ if(e.getGraphPoint() == root.getGraphPoint()
+ || e.getGraphPoint() == next.getGraphPoint()
+ || e.getGraphPoint().getPoint() == cand){
+ e = e.getNext();
+ continue;
+ }
+ inValid = VectorUtil.inCircle(root.getGraphPoint().getPoint(), next.getGraphPoint().getPoint(),
+ cand, e.getGraphPoint().getPoint());
+ if(inValid){
+ break;
+ }
+ e = e.getNext();
+ }
+ }
+ if(!inValid){
+ return candEdge;
+ }
+ return null;
+ }
+
+ /** Create a triangle from the param vertices only if
+ * the triangle is valid. IE not outside region.
+ * @param v1 vertex 1
+ * @param v2 vertex 2
+ * @param v3 vertex 3
+ * @param root and edge of this triangle
+ * @return the triangle iff it satisfies, null otherwise
+ */
+ private Triangle createTriangle(Vertex v1, Vertex v2, Vertex v3, HEdge rootT){
+ Triangle t = new Triangle(v1, v2, v3);
+ t.setVerticesBoundary(checkVerticesBoundary(rootT));
+ return t;
+ }
+
+ private boolean[] checkVerticesBoundary(HEdge rootT) {
+ boolean[] boundary = new boolean[3];
+ HEdge e1 = rootT;
+ HEdge e2 = rootT.getNext();
+ HEdge e3 = rootT.getNext().getNext();
+
+ if(e1.getGraphPoint().isBoundaryContained()){
+ boundary[0] = true;
+ }
+ if(e2.getGraphPoint().isBoundaryContained()){
+ boundary[1] = true;
+ }
+ if(e3.getGraphPoint().isBoundaryContained()){
+ boundary[2] = true;
+ }
+ return boundary;
+ }
+
+
+ /** Check if vertex inside the Loop
+ * @param vertex the Vertex
+ * @return true if the vertex is inside, false otherwise
+ */
+ public boolean checkInside(Vertex vertex) {
+ if(!box.contains(vertex.getX(), vertex.getY(), vertex.getZ())){
+ return false;
+ }
+
+ float[] center = box.getCenter();
+
+ int hits = 0;
+ HEdge current = root;
+ HEdge next = root.getNext();
+ while(next!= root){
+ if(current.getType() == HEdge.INNER || next.getType() == HEdge.INNER){
+ current = next;
+ next = current.getNext();
+ continue;
+ }
+ Vertex vert1 = current.getGraphPoint().getPoint();
+ Vertex vert2 = next.getGraphPoint().getPoint();
+
+ /** The ray is P0+s*D0, where P0 is the ray origin, D0 is a direction vector and s >= 0.
+ * The segment is P1+t*D1, where P1 and P1+D1 are the endpoints, and 0 <= t <= 1.
+ * perp(x,y) = (y,-x).
+ * if Dot(perp(D1),D0) is not zero,
+ * s = Dot(perp(D1),P1-P0)/Dot(perp(D1),D0)
+ * t = Dot(perp(D0),P1-P0)/Dot(perp(D1),D0)
+ */
+
+ float[] d0 = new float[]{center[0] - vertex.getX(), center[1]-vertex.getY(),
+ center[2]-vertex.getZ()};
+ float[] d1 = {vert2.getX() - vert1.getX(), vert2.getY() - vert1.getY(),
+ vert2.getZ() - vert1.getZ()};
+
+ float[] prep_d1 = {d1[1],-1*d1[0], d1[2]};
+ float[] prep_d0 = {d0[1],-1*d0[0], d0[2]};
+
+ float[] p0p1 = new float[]{vert1.getX() - vertex.getX(), vert1.getY() - vertex.getY(),
+ vert1.getZ() - vertex.getZ()};
+
+ float dotD1D0 = VectorUtil.dot(prep_d1, d0);
+ if(dotD1D0 == 0){
+ /** ray parallel to segment */
+ current = next;
+ next = current.getNext();
+ continue;
+ }
+
+ float s = VectorUtil.dot(prep_d1,p0p1)/dotD1D0;
+ float t = VectorUtil.dot(prep_d0,p0p1)/dotD1D0;
+
+ if(s >= 0 && t >= 0 && t<= 1){
+ hits++;
+ }
+ current = next;
+ next = current.getNext();
+ }
+
+ if(hits % 2 != 0){
+ /** check if hit count is even */
+ return true;
+ }
+ return false;
+ }
+
+ public int computeLoopSize(){
+ int size = 0;
+ HEdge e = root;
+ do{
+ size++;
+ e = e.getNext();
+ }while(e != root);
+ return size;
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java b/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java
index 36ba572..4d18800 100644
--- a/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java
+++ b/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java
@@ -38,124 +38,124 @@ import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.math.Quaternion;
public class GlyphShape {
-
- private Quaternion quat= null;
- private int numVertices = 0;
- private OutlineShape shape = null;
-
- /** Create a new Glyph shape
- * based on Parametric curve control polyline
- */
- public GlyphShape(Vertex.Factory<? extends Vertex> factory){
- shape = new OutlineShape(factory);
- }
-
- /** Create a GlyphShape from a font Path Iterator
- * @param pathIterator the path iterator
- *
- * @see PathIterator
- */
- public GlyphShape(Vertex.Factory<? extends Vertex> factory, PathIterator pathIterator){
- this(factory);
-
- if(null != pathIterator){
- while(!pathIterator.isDone()){
- float[] coords = new float[6];
- int segmentType = pathIterator.currentSegment(coords);
- addOutlineVerticesFromGlyphVector(coords, segmentType);
+
+ private Quaternion quat= null;
+ private int numVertices = 0;
+ private OutlineShape shape = null;
+
+ /** Create a new Glyph shape
+ * based on Parametric curve control polyline
+ */
+ public GlyphShape(Vertex.Factory<? extends Vertex> factory){
+ shape = new OutlineShape(factory);
+ }
+
+ /** Create a GlyphShape from a font Path Iterator
+ * @param pathIterator the path iterator
+ *
+ * @see PathIterator
+ */
+ public GlyphShape(Vertex.Factory<? extends Vertex> factory, PathIterator pathIterator){
+ this(factory);
+
+ if(null != pathIterator){
+ while(!pathIterator.isDone()){
+ float[] coords = new float[6];
+ int segmentType = pathIterator.currentSegment(coords);
+ addOutlineVerticesFromGlyphVector(coords, segmentType);
- pathIterator.next();
- }
- }
- shape.transformOutlines(OutlineShape.QUADRATIC_NURBS);
- }
-
- public final Vertex.Factory<? extends Vertex> vertexFactory() { return shape.vertexFactory(); }
-
- private void addVertexToLastOutline(Vertex vertex){
- shape.addVertex(vertex);
- }
-
- private void addOutlineVerticesFromGlyphVector(float[] coords, int segmentType){
- if(segmentType == PathIterator.SEG_MOVETO){
- if(!shape.getLastOutline().isEmpty()){
- shape.addEmptyOutline();
- }
- Vertex vert = vertexFactory().create(coords[0],coords[1]);
- vert.setOnCurve(true);
- addVertexToLastOutline(vert);
-
- numVertices++;
- }
- else if(segmentType == PathIterator.SEG_LINETO){
- Vertex vert1 = vertexFactory().create(coords[0],coords[1]);
- vert1.setOnCurve(true);
- addVertexToLastOutline(vert1);
-
- numVertices++;
- }
- else if(segmentType == PathIterator.SEG_QUADTO){
- Vertex vert1 = vertexFactory().create(coords[0],coords[1]);
- vert1.setOnCurve(false);
- addVertexToLastOutline(vert1);
+ pathIterator.next();
+ }
+ }
+ shape.transformOutlines(OutlineShape.QUADRATIC_NURBS);
+ }
+
+ public final Vertex.Factory<? extends Vertex> vertexFactory() { return shape.vertexFactory(); }
+
+ private void addVertexToLastOutline(Vertex vertex){
+ shape.addVertex(vertex);
+ }
+
+ private void addOutlineVerticesFromGlyphVector(float[] coords, int segmentType){
+ if(segmentType == PathIterator.SEG_MOVETO){
+ if(!shape.getLastOutline().isEmpty()){
+ shape.addEmptyOutline();
+ }
+ Vertex vert = vertexFactory().create(coords[0],coords[1]);
+ vert.setOnCurve(true);
+ addVertexToLastOutline(vert);
+
+ numVertices++;
+ }
+ else if(segmentType == PathIterator.SEG_LINETO){
+ Vertex vert1 = vertexFactory().create(coords[0],coords[1]);
+ vert1.setOnCurve(true);
+ addVertexToLastOutline(vert1);
+
+ numVertices++;
+ }
+ else if(segmentType == PathIterator.SEG_QUADTO){
+ Vertex vert1 = vertexFactory().create(coords[0],coords[1]);
+ vert1.setOnCurve(false);
+ addVertexToLastOutline(vert1);
- Vertex vert2 = vertexFactory().create(coords[2],coords[3]);
- vert2.setOnCurve(true);
- addVertexToLastOutline(vert2);
-
- numVertices+=2;
- }
- else if(segmentType == PathIterator.SEG_CUBICTO){
- Vertex vert1 = vertexFactory().create(coords[0],coords[1]);
- vert1.setOnCurve(false);
- addVertexToLastOutline(vert1);
+ Vertex vert2 = vertexFactory().create(coords[2],coords[3]);
+ vert2.setOnCurve(true);
+ addVertexToLastOutline(vert2);
+
+ numVertices+=2;
+ }
+ else if(segmentType == PathIterator.SEG_CUBICTO){
+ Vertex vert1 = vertexFactory().create(coords[0],coords[1]);
+ vert1.setOnCurve(false);
+ addVertexToLastOutline(vert1);
- Vertex vert2 = vertexFactory().create(coords[2],coords[3]);
- vert2.setOnCurve(false);
- addVertexToLastOutline(vert2);
+ Vertex vert2 = vertexFactory().create(coords[2],coords[3]);
+ vert2.setOnCurve(false);
+ addVertexToLastOutline(vert2);
- Vertex vert3 = vertexFactory().create(coords[4],coords[5]);
- vert3.setOnCurve(true);
- addVertexToLastOutline(vert3);
-
- numVertices+=3;
- }
- else if(segmentType == PathIterator.SEG_CLOSE){
- shape.closeLastOutline();
- }
- }
-
- public int getNumVertices() {
- return numVertices;
- }
-
- /** Get the rotational Quaternion attached to this Shape
- * @return the Quaternion Object
- */
- public Quaternion getQuat() {
- return quat;
- }
-
- /** Set the Quaternion that shall defien the rotation
- * of this shape.
- * @param quat
- */
- public void setQuat(Quaternion quat) {
- this.quat = quat;
- }
-
- /** Triangluate the glyph shape
- * @param sharpness sharpness of the curved regions default = 0.5
- * @return ArrayList of triangles which define this shape
- */
- public ArrayList<Triangle> triangulate(float sharpness){
- return shape.triangulate(sharpness);
- }
+ Vertex vert3 = vertexFactory().create(coords[4],coords[5]);
+ vert3.setOnCurve(true);
+ addVertexToLastOutline(vert3);
+
+ numVertices+=3;
+ }
+ else if(segmentType == PathIterator.SEG_CLOSE){
+ shape.closeLastOutline();
+ }
+ }
+
+ public int getNumVertices() {
+ return numVertices;
+ }
+
+ /** Get the rotational Quaternion attached to this Shape
+ * @return the Quaternion Object
+ */
+ public Quaternion getQuat() {
+ return quat;
+ }
+
+ /** Set the Quaternion that shall defien the rotation
+ * of this shape.
+ * @param quat
+ */
+ public void setQuat(Quaternion quat) {
+ this.quat = quat;
+ }
+
+ /** Triangluate the glyph shape
+ * @param sharpness sharpness of the curved regions default = 0.5
+ * @return ArrayList of triangles which define this shape
+ */
+ public ArrayList<Triangle> triangulate(float sharpness){
+ return shape.triangulate(sharpness);
+ }
- /** Get the list of Vertices of this Object
- * @return arrayList of Vertices
- */
- public ArrayList<Vertex> getVertices(){
- return shape.getVertices();
- }
+ /** Get the list of Vertices of this Object
+ * @return arrayList of Vertices
+ */
+ public ArrayList<Vertex> getVertices(){
+ return shape.getVertices();
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java b/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java
index 7c7bb81..7056134 100644
--- a/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java
+++ b/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java
@@ -47,122 +47,122 @@ import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.opengl.util.glsl.ShaderState;
public class GlyphString {
- private final Vertex.Factory<? extends Vertex> pointFactory;
- private ArrayList<GlyphShape> glyphs = new ArrayList<GlyphShape>();
- private String str = "";
- private String fontname = "";
- private Region region;
-
- private SVertex origin = new SVertex();
+ private final Vertex.Factory<? extends Vertex> pointFactory;
+ private ArrayList<GlyphShape> glyphs = new ArrayList<GlyphShape>();
+ private String str = "";
+ private String fontname = "";
+ private Region region;
+
+ private SVertex origin = new SVertex();
- /** Create a new GlyphString object
- * @param fontname the name of the font that this String is
- * associated with
- * @param str the string object
- */
- public GlyphString(Vertex.Factory<? extends Vertex> factory, String fontname, String str){
- pointFactory = factory;
- this.fontname = fontname;
- this.str = str;
- }
-
- public final Vertex.Factory<? extends Vertex> pointFactory() { return pointFactory; }
-
- public void addGlyphShape(GlyphShape glyph){
- glyphs.add(glyph);
- }
- public String getString(){
- return str;
- }
+ /** Create a new GlyphString object
+ * @param fontname the name of the font that this String is
+ * associated with
+ * @param str the string object
+ */
+ public GlyphString(Vertex.Factory<? extends Vertex> factory, String fontname, String str){
+ pointFactory = factory;
+ this.fontname = fontname;
+ this.str = str;
+ }
+
+ public final Vertex.Factory<? extends Vertex> pointFactory() { return pointFactory; }
+
+ public void addGlyphShape(GlyphShape glyph){
+ glyphs.add(glyph);
+ }
+ public String getString(){
+ return str;
+ }
- /** Creates the Curve based Glyphs from a Font
- * @param paths a list of FontPath2D objects that define the outline
- * @param affineTransform a global affine transformation applied to the paths.
- */
- public void createfromFontPath(Path2D[] paths, AffineTransform affineTransform){
- final int numGlyps = paths.length;
- for (int index=0;index<numGlyps;index++){
- if(paths[index] == null){
- continue;
- }
- PathIterator iterator = paths[index].iterator(affineTransform);
- GlyphShape glyphShape = new GlyphShape(pointFactory, iterator);
-
- if(glyphShape.getNumVertices() < 3) {
- continue;
- }
- addGlyphShape(glyphShape);
- }
- }
-
- private ArrayList<Triangle> initializeTriangles(float sharpness){
- ArrayList<Triangle> triangles = new ArrayList<Triangle>();
- for(GlyphShape glyph:glyphs){
- ArrayList<Triangle> tris = glyph.triangulate(sharpness);
- triangles.addAll(tris);
- }
- return triangles;
- }
-
- /** Generate a OGL Region to represent this Object.
- * @param context the GLContext which the region is defined by.
- * @param shaprness the curvature sharpness of the object.
- * @param st shader state
- */
- public void generateRegion(GLContext context, float shaprness, ShaderState st, int type){
- region = RegionFactory.create(context, st, type);
- region.setFlipped(true);
-
- ArrayList<Triangle> tris = initializeTriangles(shaprness);
- region.addTriangles(tris);
-
- int numVertices = region.getNumVertices();
- for(GlyphShape glyph:glyphs){
- ArrayList<Vertex> gVertices = glyph.getVertices();
- for(Vertex vert:gVertices){
- vert.setId(numVertices++);
- }
- region.addVertices(gVertices);
- }
-
- /** initialize the region */
- region.update();
- }
-
- /** Generate a Hashcode for this object
- * @return a string defining the hashcode
- */
- public String getTextHashCode(){
- return "" + fontname.hashCode() + str.hashCode();
- }
+ /** Creates the Curve based Glyphs from a Font
+ * @param paths a list of FontPath2D objects that define the outline
+ * @param affineTransform a global affine transformation applied to the paths.
+ */
+ public void createfromFontPath(Path2D[] paths, AffineTransform affineTransform){
+ final int numGlyps = paths.length;
+ for (int index=0;index<numGlyps;index++){
+ if(paths[index] == null){
+ continue;
+ }
+ PathIterator iterator = paths[index].iterator(affineTransform);
+ GlyphShape glyphShape = new GlyphShape(pointFactory, iterator);
+
+ if(glyphShape.getNumVertices() < 3) {
+ continue;
+ }
+ addGlyphShape(glyphShape);
+ }
+ }
+
+ private ArrayList<Triangle> initializeTriangles(float sharpness){
+ ArrayList<Triangle> triangles = new ArrayList<Triangle>();
+ for(GlyphShape glyph:glyphs){
+ ArrayList<Triangle> tris = glyph.triangulate(sharpness);
+ triangles.addAll(tris);
+ }
+ return triangles;
+ }
+
+ /** Generate a OGL Region to represent this Object.
+ * @param context the GLContext which the region is defined by.
+ * @param shaprness the curvature sharpness of the object.
+ * @param st shader state
+ */
+ public void generateRegion(GLContext context, float shaprness, ShaderState st, int type){
+ region = RegionFactory.create(context, st, type);
+ region.setFlipped(true);
+
+ ArrayList<Triangle> tris = initializeTriangles(shaprness);
+ region.addTriangles(tris);
+
+ int numVertices = region.getNumVertices();
+ for(GlyphShape glyph:glyphs){
+ ArrayList<Vertex> gVertices = glyph.getVertices();
+ for(Vertex vert:gVertices){
+ vert.setId(numVertices++);
+ }
+ region.addVertices(gVertices);
+ }
+
+ /** initialize the region */
+ region.update();
+ }
+
+ /** Generate a Hashcode for this object
+ * @return a string defining the hashcode
+ */
+ public String getTextHashCode(){
+ return "" + fontname.hashCode() + str.hashCode();
+ }
- /** Render the Object based using the associated Region
- * previously generated.
- */
- public void renderString3D() {
- region.render(null, 0, 0, 0);
- }
- /** Render the Object based using the associated Region
- * previously generated.
- */
- public void renderString3D(PMVMatrix matrix, int vp_width, int vp_height, int size) {
- region.render(matrix, vp_width, vp_height, size);
- }
-
- /** Get the Origion of this GlyphString
- * @return
- */
- public Vertex getOrigin() {
- return origin;
- }
+ /** Render the Object based using the associated Region
+ * previously generated.
+ */
+ public void renderString3D() {
+ region.render(null, 0, 0, 0);
+ }
+ /** Render the Object based using the associated Region
+ * previously generated.
+ */
+ public void renderString3D(PMVMatrix matrix, int vp_width, int vp_height, int size) {
+ region.render(matrix, vp_width, vp_height, size);
+ }
+
+ /** Get the Origion of this GlyphString
+ * @return
+ */
+ public Vertex getOrigin() {
+ return origin;
+ }
- /** Destroy the associated OGL objects
- */
- public void destroy(){
- region.destroy();
- }
-
- public AABBox getBounds(){
- return region.getBounds();
- }
+ /** Destroy the associated OGL objects
+ */
+ public void destroy(){
+ region.destroy();
+ }
+
+ public AABBox getBounds(){
+ return region.getBounds();
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java
index a9ab902..bead9a5 100644
--- a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java
+++ b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java
@@ -74,7 +74,7 @@ public class JavaFontLoader implements FontSet {
return get(FAMILY_REGULAR, 0) ; // Sans Serif Regular
}
- public Font get(int family, int style) {
+ public Font get(int family, int style) {
Font font = (Font)fontMap.get( ( family << 8 ) | style );
if (font != null) {
return font;
@@ -121,7 +121,7 @@ public class JavaFontLoader implements FontSet {
return font;
}
-
+
Font abspath(String fname, int family, int style) {
final String err = "Problem loading font "+fname+", file "+javaFontPath+fname ;
diff --git a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java
index 3614add..17db088 100644
--- a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java
+++ b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java
@@ -76,8 +76,8 @@ public class UbuntuFontLoader implements FontSet {
return get(FAMILY_REGULAR, 0) ; // Sans Serif Regular
}
- public Font get(int family, int style)
- {
+ public Font get(int family, int style)
+ {
Font font = (Font)fontMap.get( ( family << 8 ) | style );
if (font != null) {
return font;
@@ -119,7 +119,7 @@ public class UbuntuFontLoader implements FontSet {
return font;
}
-
+
Font abspath(String fname, int family, int style) {
final String err = "Problem loading font "+fname+", stream "+relPath+fname;
try {
@@ -136,5 +136,5 @@ public class UbuntuFontLoader implements FontSet {
} catch(IOException ioe) {
throw new GLException(err, ioe);
}
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
index f702b98..6292c88 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
@@ -43,97 +43,97 @@ import com.jogamp.graph.font.FontFactory;
import com.jogamp.graph.geom.AABBox;
class TypecastFont implements FontInt {
- static final boolean DEBUG = false;
-
- final OTFontCollection fontset;
- final OTFont font;
+ static final boolean DEBUG = false;
+
+ final OTFontCollection fontset;
+ final OTFont font;
TypecastHMetrics metrics;
final CmapFormat cmapFormat;
- int cmapentries;
-
- // FIXME: Add cache size to limit memory usage ??
+ int cmapentries;
+
+ // FIXME: Add cache size to limit memory usage ??
IntObjectHashMap char2Glyph;
public TypecastFont(OTFontCollection fontset) {
- this.fontset = fontset;
+ this.fontset = fontset;
this.font = fontset.getFont(0);
// FIXME: Generic attempt to find the best CmapTable,
// which is assumed to be the one with the most entries (stupid 'eh?)
- CmapTable cmapTable = font.getCmapTable();
+ CmapTable cmapTable = font.getCmapTable();
CmapFormat[] _cmapFormatP = { null, null, null, null };
int platform = -1;
int platformLength = -1;
int encoding = -1;
- for(int i=0; i<cmapTable.getNumTables(); i++) {
- CmapIndexEntry cmapIdxEntry = cmapTable.getCmapIndexEntry(i);
- int pidx = cmapIdxEntry.getPlatformId();
- CmapFormat cf = cmapIdxEntry.getFormat();
+ for(int i=0; i<cmapTable.getNumTables(); i++) {
+ CmapIndexEntry cmapIdxEntry = cmapTable.getCmapIndexEntry(i);
+ int pidx = cmapIdxEntry.getPlatformId();
+ CmapFormat cf = cmapIdxEntry.getFormat();
if(DEBUG) {
System.err.println("CmapFormat["+i+"]: platform " + pidx +
", encoding "+cmapIdxEntry.getEncodingId() + ": "+cf);
}
- if( _cmapFormatP[pidx] == null ||
- _cmapFormatP[pidx].getLength() < cf.getLength() ) {
- _cmapFormatP[pidx] = cf;
- if( cf.getLength() > platformLength ) {
- platformLength = cf.getLength() ;
- platform = pidx;
- encoding = cmapIdxEntry.getEncodingId();
- }
- }
- }
+ if( _cmapFormatP[pidx] == null ||
+ _cmapFormatP[pidx].getLength() < cf.getLength() ) {
+ _cmapFormatP[pidx] = cf;
+ if( cf.getLength() > platformLength ) {
+ platformLength = cf.getLength() ;
+ platform = pidx;
+ encoding = cmapIdxEntry.getEncodingId();
+ }
+ }
+ }
if(0 <= platform) {
cmapFormat = _cmapFormatP[platform];
if(DEBUG) {
System.err.println("Selected CmapFormat: platform " + platform +
", encoding "+encoding + ": "+cmapFormat);
}
- } else {
- CmapFormat _cmapFormat = null;
- /*if(null == _cmapFormat) {
+ } else {
+ CmapFormat _cmapFormat = null;
+ /*if(null == _cmapFormat) {
platform = ID.platformMacintosh;
encoding = ID.encodingASCII;
- _cmapFormat = cmapTable.getCmapFormat(platform, encoding);
- } */
- if(null == _cmapFormat) {
- // default unicode
- platform = ID.platformMicrosoft;
- encoding = ID.encodingUnicode;
- _cmapFormat = cmapTable.getCmapFormat((short)platform, (short)encoding);
- }
- if(null == _cmapFormat) {
- // maybe a symbol font ?
+ _cmapFormat = cmapTable.getCmapFormat(platform, encoding);
+ } */
+ if(null == _cmapFormat) {
+ // default unicode
+ platform = ID.platformMicrosoft;
+ encoding = ID.encodingUnicode;
+ _cmapFormat = cmapTable.getCmapFormat((short)platform, (short)encoding);
+ }
+ if(null == _cmapFormat) {
+ // maybe a symbol font ?
platform = ID.platformMicrosoft;
encoding = ID.encodingSymbol;
_cmapFormat = cmapTable.getCmapFormat((short)platform, (short)encoding);
- }
- if(null == _cmapFormat) {
- throw new RuntimeException("Cannot find a suitable cmap table for font "+font);
- }
+ }
+ if(null == _cmapFormat) {
+ throw new RuntimeException("Cannot find a suitable cmap table for font "+font);
+ }
cmapFormat = _cmapFormat;
if(DEBUG) {
System.err.println("Selected CmapFormat (2): platform " + platform + ", encoding "+encoding + ": "+cmapFormat);
}
}
- cmapentries = 0;
+ cmapentries = 0;
for (int i = 0; i < cmapFormat.getRangeCount(); ++i) {
CmapFormat.Range range = cmapFormat.getRange(i);
cmapentries += range.getEndCode() - range.getStartCode() + 1; // end included
- }
+ }
if(DEBUG) {
- System.err.println("num glyphs: "+font.getNumGlyphs());
- System.err.println("num cmap entries: "+cmapentries);
- System.err.println("num cmap ranges: "+cmapFormat.getRangeCount());
+ System.err.println("num glyphs: "+font.getNumGlyphs());
+ System.err.println("num cmap entries: "+cmapentries);
+ System.err.println("num cmap ranges: "+cmapFormat.getRangeCount());
for (int i = 0; i < cmapFormat.getRangeCount(); ++i) {
CmapFormat.Range range = cmapFormat.getRange(i);
for (int j = range.getStartCode(); j <= range.getEndCode(); ++j) {
- final int code = cmapFormat.mapCharCode(j);
- if(code < 15) {
- System.err.println(" char: " + (int)j + " ( " + (char)j +" ) -> " + code);
- }
+ final int code = cmapFormat.mapCharCode(j);
+ if(code < 15) {
+ System.err.println(" char: " + (int)j + " ( " + (char)j +" ) -> " + code);
+ }
}
}
}
@@ -155,9 +155,9 @@ class TypecastFont implements FontInt {
}
public Glyph getGlyph(char symbol) {
- TypecastGlyph result = (TypecastGlyph) char2Glyph.get(symbol);
+ TypecastGlyph result = (TypecastGlyph) char2Glyph.get(symbol);
if (null == result) {
- // final short code = (short) char2Code.get(symbol);
+ // final short code = (short) char2Code.get(symbol);
short code = (short) cmapFormat.mapCharCode(symbol);
if(0 == code && 0 != symbol) {
// reserved special glyph IDs by convention
@@ -168,19 +168,19 @@ class TypecastFont implements FontInt {
}
}
- jogamp.graph.font.typecast.ot.OTGlyph glyph = font.getGlyph(code);
- if(null == glyph) {
- glyph = font.getGlyph(Glyph.ID_UNKNOWN);
- }
- if(null == glyph) {
- throw new RuntimeException("Could not retrieve glyph for symbol: <"+symbol+"> "+(int)symbol+" -> glyph id "+code);
- }
- Path2D path = TypecastRenderer.buildPath(glyph);
- result = new TypecastGlyph(this, symbol, code, glyph.getBBox(), glyph.getAdvanceWidth(), path);
- if(DEBUG) {
- System.err.println("New glyph: " + (int)symbol + " ( " + (char)symbol +" ) -> " + code + ", contours " + glyph.getPointCount() + ": " + path);
- }
- final HdmxTable hdmx = font.getHdmxTable();
+ jogamp.graph.font.typecast.ot.OTGlyph glyph = font.getGlyph(code);
+ if(null == glyph) {
+ glyph = font.getGlyph(Glyph.ID_UNKNOWN);
+ }
+ if(null == glyph) {
+ throw new RuntimeException("Could not retrieve glyph for symbol: <"+symbol+"> "+(int)symbol+" -> glyph id "+code);
+ }
+ Path2D path = TypecastRenderer.buildPath(glyph);
+ result = new TypecastGlyph(this, symbol, code, glyph.getBBox(), glyph.getAdvanceWidth(), path);
+ if(DEBUG) {
+ System.err.println("New glyph: " + (int)symbol + " ( " + (char)symbol +" ) -> " + code + ", contours " + glyph.getPointCount() + ": " + path);
+ }
+ final HdmxTable hdmx = font.getHdmxTable();
if (null!= result && null != hdmx) {
/*if(DEBUG) {
System.err.println("hdmx "+hdmx);
@@ -193,14 +193,14 @@ class TypecastFont implements FontInt {
System.err.println("hdmx advance : pixelsize = "+dr.getWidth(code)+" : "+ dr.getPixelSize());
}
}
- }
- char2Glyph.put(symbol, result);
+ }
+ char2Glyph.put(symbol, result);
}
return result;
}
public void getOutline(String string, float pixelSize, AffineTransform transform, Path2D[] result) {
- TypecastRenderer.getOutline(this, string, pixelSize, transform, result);
+ TypecastRenderer.getOutline(this, string, pixelSize, transform, result);
}
public float getStringWidth(String string, float pixelSize) {
@@ -217,7 +217,7 @@ class TypecastFont implements FontInt {
}
}
- return (int)(width + 0.5f);
+ return (int)(width + 0.5f);
}
public float getStringHeight(String string, float pixelSize) {
@@ -233,7 +233,7 @@ class TypecastFont implements FontInt {
height = (int)Math.ceil(Math.max(bbox.getHeight(), height));
}
}
- return height;
+ return height;
}
public AABBox getStringBounds(CharSequence string, float pixelSize) {
@@ -263,11 +263,11 @@ class TypecastFont implements FontInt {
totalHeight -= advanceY;
totalWidth = Math.max(curLineWidth, totalWidth);
}
- return new AABBox(0, 0, 0, totalWidth, totalHeight,0);
+ return new AABBox(0, 0, 0, totalWidth, totalHeight,0);
}
final public int getNumGlyphs() {
- return font.getNumGlyphs();
+ return font.getNumGlyphs();
}
public boolean isPrintableChar( char c ) {
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java
index 88d865f..f20b7d1 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java
@@ -42,7 +42,7 @@ public class TypecastGlyph implements FontInt.Glyph {
final Font font;
final float advance;
HashMap<Float, Float> size2advance = new HashMap<Float, Float>();
-
+
public Advance(Font font, float advance)
{
this.font = font;
@@ -86,12 +86,12 @@ public class TypecastGlyph implements FontInt.Glyph {
"\n advances: \n"+size2advance;
}
}
-
+
public class Metrics
{
- AABBox bbox;
+ AABBox bbox;
Advance advance;
-
+
public Metrics(Font font, AABBox bbox, float advance)
{
this.bbox = bbox;
@@ -128,13 +128,13 @@ public class TypecastGlyph implements FontInt.Glyph {
"\n bbox: "+this.bbox+
this.advance;
}
- }
+ }
public static final short INVALID_ID = (short)((1 << 16) - 1);
public static final short MAX_ID = (short)((1 << 16) - 2);
private final Font font;
-
+
char symbol;
short id;
int advance;
@@ -143,15 +143,15 @@ public class TypecastGlyph implements FontInt.Glyph {
protected Path2D path; // in EM units
protected Path2D pathSized;
protected float numberSized;
-
+
protected TypecastGlyph(Font font, char symbol) {
- this.font = font;
+ this.font = font;
this.symbol = symbol;
}
protected TypecastGlyph(Font font,
- char symbol, short id, AABBox bbox, int advance, Path2D path) {
- this.font = font;
+ char symbol, short id, AABBox bbox, int advance, Path2D path) {
+ this.font = font;
this.symbol = symbol;
this.advance = advance;
@@ -161,7 +161,7 @@ public class TypecastGlyph implements FontInt.Glyph {
this.pathSized = null;
this.numberSized = 0.0f;
}
-
+
void init(short id, AABBox bbox, int advance) {
this.id = id;
this.advance = advance;
@@ -176,11 +176,11 @@ public class TypecastGlyph implements FontInt.Glyph {
public Font getFont() {
return this.font;
}
-
+
public char getSymbol() {
return this.symbol;
}
-
+
AABBox getBBoxUnsized() {
return this.metrics.getBBox();
}
@@ -192,22 +192,22 @@ public class TypecastGlyph implements FontInt.Glyph {
public Metrics getMetrics() {
return this.metrics;
}
-
+
public short getID() {
return this.id;
}
-
+
public float getScale(float pixelSize) {
return this.metrics.getScale(pixelSize);
}
-
+
public AABBox getBBox(float pixelSize) {
final float size = getScale(pixelSize);
AABBox newBox = getBBox().clone();
newBox.scale(size);
return newBox;
}
-
+
protected void addAdvance(float advance, float size) {
this.metrics.addAdvance(advance, size);
}
@@ -217,9 +217,9 @@ public class TypecastGlyph implements FontInt.Glyph {
}
public Path2D getPath() {
- return this.path;
+ return this.path;
}
-
+
public Path2D getPath(float pixelSize) {
final float size = getScale(pixelSize);
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java
index a699480..0dd7a61 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java
@@ -34,22 +34,22 @@ import com.jogamp.graph.font.Font.Metrics;
import com.jogamp.graph.geom.AABBox;
class TypecastHMetrics implements Metrics {
- private final TypecastFont fontImpl;
-
- // HeadTable
+ private final TypecastFont fontImpl;
+
+ // HeadTable
private final HeadTable headTable;
- private final float unitsPerEM_Inv;
- private final AABBox bbox;
- // HheaTable
- private final HheaTable hheaTable;
+ private final float unitsPerEM_Inv;
+ private final AABBox bbox;
+ // HheaTable
+ private final HheaTable hheaTable;
// VheaTable (for horizontal fonts)
// private final VheaTable vheaTable;
-
- public TypecastHMetrics(TypecastFont fontImpl) {
- this.fontImpl = fontImpl;
- headTable = this.fontImpl.font.getHeadTable();
- hheaTable = this.fontImpl.font.getHheaTable();
- // vheaTable = this.fontImpl.font.getVheaTable();
+
+ public TypecastHMetrics(TypecastFont fontImpl) {
+ this.fontImpl = fontImpl;
+ headTable = this.fontImpl.font.getHeadTable();
+ hheaTable = this.fontImpl.font.getHheaTable();
+ // vheaTable = this.fontImpl.font.getVheaTable();
unitsPerEM_Inv = 1.0f / ( (float) headTable.getUnitsPerEm() );
int maxWidth = headTable.getXMax() - headTable.getXMin();
@@ -59,8 +59,8 @@ class TypecastHMetrics implements Metrics {
float highx = lowx + maxWidth;
float highy = lowy + maxHeight;
bbox = new AABBox(lowx, lowy, 0, highx, highy, 0); // invert
- }
-
+ }
+
public final float getAscent(float pixelSize) {
return getScale(pixelSize) * -hheaTable.getAscender(); // invert
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java
index 9a81d78..ab5e673 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java
@@ -40,48 +40,48 @@ import com.jogamp.graph.font.Font;
*/
public class TypecastRenderer {
- public static void getOutline(TypecastFont font,
- String string, float pixelSize, AffineTransform transform, Path2D[] p)
- {
- if (string == null) {
- return;
- }
- Font.Metrics metrics = font.getMetrics();
- float advanceTotal = 0;
- float lineGap = metrics.getLineGap(pixelSize) ;
- float ascent = metrics.getAscent(pixelSize) ;
- float descent = metrics.getDescent(pixelSize) ;
- if (transform == null) {
- transform = new AffineTransform();
- }
- AffineTransform t = new AffineTransform();
+ public static void getOutline(TypecastFont font,
+ String string, float pixelSize, AffineTransform transform, Path2D[] p)
+ {
+ if (string == null) {
+ return;
+ }
+ Font.Metrics metrics = font.getMetrics();
+ float advanceTotal = 0;
+ float lineGap = metrics.getLineGap(pixelSize) ;
+ float ascent = metrics.getAscent(pixelSize) ;
+ float descent = metrics.getDescent(pixelSize) ;
+ if (transform == null) {
+ transform = new AffineTransform();
+ }
+ AffineTransform t = new AffineTransform();
- float advanceY = lineGap - descent + ascent;
- float y = 0;
- for (int i=0; i<string.length(); i++)
- {
- p[i] = new Path2D();
- p[i].reset();
- t.setTransform(transform);
- char character = string.charAt(i);
- if (character == '\n') {
- y -= advanceY;
- advanceTotal = 0;
- continue;
- } else if (character == ' ') {
- advanceTotal += font.font.getHmtxTable().getAdvanceWidth(TypecastGlyph.ID_SPACE) * metrics.getScale(pixelSize);
+ float advanceY = lineGap - descent + ascent;
+ float y = 0;
+ for (int i=0; i<string.length(); i++)
+ {
+ p[i] = new Path2D();
+ p[i].reset();
+ t.setTransform(transform);
+ char character = string.charAt(i);
+ if (character == '\n') {
+ y -= advanceY;
+ advanceTotal = 0;
+ continue;
+ } else if (character == ' ') {
+ advanceTotal += font.font.getHmtxTable().getAdvanceWidth(TypecastGlyph.ID_SPACE) * metrics.getScale(pixelSize);
continue;
}
- TypecastGlyph glyph = (TypecastGlyph) font.getGlyph(character);
- Path2D gp = glyph.getPath();
- float scale = metrics.getScale(pixelSize);
- t.translate(advanceTotal, y);
- t.scale(scale, scale);
- p[i].append(gp.iterator(t), false);
- advanceTotal += glyph.getAdvance(pixelSize, true);
- }
- }
-
+ TypecastGlyph glyph = (TypecastGlyph) font.getGlyph(character);
+ Path2D gp = glyph.getPath();
+ float scale = metrics.getScale(pixelSize);
+ t.translate(advanceTotal, y);
+ t.scale(scale, scale);
+ p[i].append(gp.iterator(t), false);
+ advanceTotal += glyph.getAdvance(pixelSize, true);
+ }
+ }
+
/**
* Build a {@link com.jogamp.graph.geom.Path2D Path2D} from a
* {@link jogamp.graph.font.typecast.ot.OTGlyph Glyph}. This glyph path can then
@@ -116,44 +116,44 @@ public class TypecastRenderer {
Point point = glyph.getPoint(startIndex + offset%count);
Point point_plus1 = glyph.getPoint(startIndex + (offset+1)%count);
Point point_plus2 = glyph.getPoint(startIndex + (offset+2)%count);
- if(offset == 0)
+ if(offset == 0)
{
gp.moveTo(point.x, -point.y);
}
-
- if (point.onCurve) {
- if (point_plus1.onCurve) {
- // s = new Line2D.Float(point.x, -point.y, point_plus1.x, -point_plus1.y);
- gp.lineTo( point_plus1.x, -point_plus1.y );
- offset++;
- } else {
- if (point_plus2.onCurve) {
- // s = new QuadCurve2D.Float( point.x, -point.y, point_plus1.x, -point_plus1.y, point_plus2.x, -point_plus2.y);
- gp.quadTo(point_plus1.x, -point_plus1.y, point_plus2.x, -point_plus2.y);
- offset+=2;
- } else {
- // s = new QuadCurve2D.Float(point.x,-point.y,point_plus1.x,-point_plus1.y,
- // midValue(point_plus1.x, point_plus2.x), -midValue(point_plus1.y, point_plus2.y));
- gp.quadTo(point_plus1.x, -point_plus1.y, midValue(point_plus1.x, point_plus2.x), -midValue(point_plus1.y, point_plus2.y));
- offset+=2;
- }
- }
- } else {
- if (point_plus1.onCurve) {
- // s = new QuadCurve2D.Float(midValue(point_minus1.x, point.x), -midValue(point_minus1.y, point.y),
- // point.x, -point.y, point_plus1.x, -point_plus1.y);
- //gp.curve3(point_plus1.x, -point_plus1.y, point.x, -point.y);
- gp.quadTo(point.x, -point.y, point_plus1.x, -point_plus1.y);
- offset++;
-
- } else {
- // s = new QuadCurve2D.Float(midValue(point_minus1.x, point.x), -midValue(point_minus1.y, point.y), point.x, -point.y,
- // midValue(point.x, point_plus1.x), -midValue(point.y, point_plus1.y));
- //gp.curve3(midValue(point.x, point_plus1.x), -midValue(point.y, point_plus1.y), point.x, -point.y);
- gp.quadTo(point.x, -point.y, midValue(point.x, point_plus1.x), -midValue(point.y, point_plus1.y));
- offset++;
- }
- }
+
+ if (point.onCurve) {
+ if (point_plus1.onCurve) {
+ // s = new Line2D.Float(point.x, -point.y, point_plus1.x, -point_plus1.y);
+ gp.lineTo( point_plus1.x, -point_plus1.y );
+ offset++;
+ } else {
+ if (point_plus2.onCurve) {
+ // s = new QuadCurve2D.Float( point.x, -point.y, point_plus1.x, -point_plus1.y, point_plus2.x, -point_plus2.y);
+ gp.quadTo(point_plus1.x, -point_plus1.y, point_plus2.x, -point_plus2.y);
+ offset+=2;
+ } else {
+ // s = new QuadCurve2D.Float(point.x,-point.y,point_plus1.x,-point_plus1.y,
+ // midValue(point_plus1.x, point_plus2.x), -midValue(point_plus1.y, point_plus2.y));
+ gp.quadTo(point_plus1.x, -point_plus1.y, midValue(point_plus1.x, point_plus2.x), -midValue(point_plus1.y, point_plus2.y));
+ offset+=2;
+ }
+ }
+ } else {
+ if (point_plus1.onCurve) {
+ // s = new QuadCurve2D.Float(midValue(point_minus1.x, point.x), -midValue(point_minus1.y, point.y),
+ // point.x, -point.y, point_plus1.x, -point_plus1.y);
+ //gp.curve3(point_plus1.x, -point_plus1.y, point.x, -point.y);
+ gp.quadTo(point.x, -point.y, point_plus1.x, -point_plus1.y);
+ offset++;
+
+ } else {
+ // s = new QuadCurve2D.Float(midValue(point_minus1.x, point.x), -midValue(point_minus1.y, point.y), point.x, -point.y,
+ // midValue(point.x, point_plus1.x), -midValue(point.y, point_plus1.y));
+ //gp.curve3(midValue(point.x, point_plus1.x), -midValue(point.y, point_plus1.y), point.x, -point.y);
+ gp.quadTo(point.x, -point.y, midValue(point.x, point_plus1.x), -midValue(point.y, point_plus1.y));
+ offset++;
+ }
+ }
}
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java
index 5afb939..6b3dc1f 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java
@@ -72,9 +72,9 @@ public class Mnemonic {
public static final short RS = 0x43;
public static final short WCVTP = 0x44;
public static final short RCVT = 0x45;
- public static final short GC = 0x46; // [a]
+ public static final short GC = 0x46; // [a]
public static final short SCFS = 0x48;
- public static final short MD = 0x49; // [a]
+ public static final short MD = 0x49; // [a]
public static final short MPPEM = 0x4B;
public static final short MPS = 0x4C;
public static final short FLIPON = 0x4D;
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java
index 17b5af5..6e7e76b 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java
@@ -182,8 +182,8 @@ public class OTFont {
}
public OTGlyph getGlyph(int i) {
-
- final GlyfDescript _glyfDescr = _glyf.getDescription(i);
+
+ final GlyfDescript _glyfDescr = _glyf.getDescription(i);
return (null != _glyfDescr)
? new OTGlyph(
_glyfDescr,
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java
index 4b6242d..5c00424 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java
@@ -103,7 +103,7 @@ public class OTGlyph {
}
public AABBox getBBox() {
- return _bbox;
+ return _bbox;
}
public int getAdvanceWidth() {
@@ -164,6 +164,6 @@ public class OTGlyph {
// _points[gd.getPointCount()] = new Point(0, 0, true, true);
// _points[gd.getPointCount()+1] = new Point(_advanceWidth, 0, true, true);
- _bbox = new AABBox(gd.getXMinimum(), gd.getYMinimum(), 0, gd.getXMaximum(), gd.getYMaximum(), 0);
+ _bbox = new AABBox(gd.getXMinimum(), gd.getYMinimum(), 0, gd.getXMaximum(), gd.getYMaximum(), 0);
}
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java
index ed82f26..4804c35 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java
@@ -175,15 +175,15 @@ public class PostTable implements Table {
"lessequal", // 148
"greaterequal", // 149
"yen", // 150
- "mu", // 151
+ "mu", // 151
"partialdiff", // 152
"summation", // 153
"product", // 154
- "pi", // 155
+ "pi", // 155
"integral'", // 156
"ordfeminine", // 157
"ordmasculine", // 158
- "Omega", // 159
+ "Omega", // 159
"ae", // 160
"oslash", // 161
"questiondown", // 162
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java b/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java
index 252c6ac..a659a70 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java
@@ -140,8 +140,8 @@ public class Interpreter {
private void _deltac1() {
int n = pop();
for (int i = 0; i < n; i++) {
- pop(); // pn
- pop(); // argn
+ pop(); // pn
+ pop(); // argn
}
}
@@ -151,8 +151,8 @@ public class Interpreter {
private void _deltac2() {
int n = pop();
for (int i = 0; i < n; i++) {
- pop(); // pn
- pop(); // argn
+ pop(); // pn
+ pop(); // argn
}
}
@@ -162,8 +162,8 @@ public class Interpreter {
private void _deltac3() {
int n = pop();
for (int i = 0; i < n; i++) {
- pop(); // pn
- pop(); // argn
+ pop(); // pn
+ pop(); // argn
}
}
@@ -173,8 +173,8 @@ public class Interpreter {
private void _deltap1() {
int n = pop();
for (int i = 0; i < n; i++) {
- pop(); // pn
- pop(); // argn
+ pop(); // pn
+ pop(); // argn
}
}
@@ -184,8 +184,8 @@ public class Interpreter {
private void _deltap2() {
int n = pop();
for (int i = 0; i < n; i++) {
- pop(); // pn
- pop(); // argn
+ pop(); // pn
+ pop(); // argn
}
}
@@ -195,8 +195,8 @@ public class Interpreter {
private void _deltap3() {
int n = pop();
for (int i = 0; i < n; i++) {
- pop(); // pn
- pop(); // argn
+ pop(); // pn
+ pop(); // argn
}
}
@@ -407,12 +407,12 @@ public class Interpreter {
* to inhibit grid-fitting when a glyph is being rotated or stretched, use the
* following sequence on the preprogram:
*
- * PUSHB[000] 6 ; ask GETINFO to check for stretching or rotation
- * GETINFO[] ; will push TRUE if glyph is stretched or rotated
- * IF[] ; tests value at top of stack
- * PUSHB[000] 1 ; value for INSTCTRL
- * PUSHB[000] 1 ; selector for INSTCTRL
- * INSTRCTRL[] ; based on selector and value will turn grid-fitting off
+ * PUSHB[000] 6 ; ask GETINFO to check for stretching or rotation
+ * GETINFO[] ; will push TRUE if glyph is stretched or rotated
+ * IF[] ; tests value at top of stack
+ * PUSHB[000] 1 ; value for INSTCTRL
+ * PUSHB[000] 1 ; selector for INSTCTRL
+ * INSTRCTRL[] ; based on selector and value will turn grid-fitting off
* EIF[]
*
* Selector flag 2 is used to establish that any parameters set in the CVT program
@@ -923,8 +923,8 @@ public class Interpreter {
* Set Freedom_Vector From Stack
*/
private void _sfvfs() {
- gs.freedom_vector[1] = pop(); // y
- gs.freedom_vector[0] = pop(); // x
+ gs.freedom_vector[1] = pop(); // y
+ gs.freedom_vector[0] = pop(); // x
}
/*
@@ -988,9 +988,9 @@ public class Interpreter {
* USES: loop
*/
private void _shpix() {
- pop(); // amount
+ pop(); // amount
while (gs.loop-- > 0) {
- pop(); // p
+ pop(); // p
}
gs.loop = 1;
}
@@ -1017,8 +1017,8 @@ public class Interpreter {
* Set Projection_Vector From Stack
*/
private void _spvfs() {
- gs.projection_vector[1] = pop(); // y
- gs.projection_vector[0] = pop(); // x
+ gs.projection_vector[1] = pop(); // y
+ gs.projection_vector[0] = pop(); // x
}
/*
diff --git a/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java b/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java
index 3e2a594..79e8428 100644
--- a/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java
+++ b/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java
@@ -80,14 +80,14 @@ public class AffineTransform implements Cloneable, Serializable {
}
public AffineTransform(Factory<? extends Vertex> factory) {
- pointFactory = factory;
+ pointFactory = factory;
type = TYPE_IDENTITY;
m00 = m11 = 1.0f;
m10 = m01 = m02 = m12 = 0.0f;
}
public AffineTransform(AffineTransform t) {
- this.pointFactory = t.pointFactory;
+ this.pointFactory = t.pointFactory;
this.type = t.type;
this.m00 = t.m00;
this.m10 = t.m10;
@@ -98,7 +98,7 @@ public class AffineTransform implements Cloneable, Serializable {
}
public AffineTransform(Vertex.Factory<? extends Vertex> factory, float m00, float m10, float m01, float m11, float m02, float m12) {
- pointFactory = factory;
+ pointFactory = factory;
this.type = TYPE_UNKNOWN;
this.m00 = m00;
this.m10 = m10;
@@ -109,7 +109,7 @@ public class AffineTransform implements Cloneable, Serializable {
}
public AffineTransform(Vertex.Factory<? extends Vertex> factory, float[] matrix) {
- pointFactory = factory;
+ pointFactory = factory;
this.type = TYPE_UNKNOWN;
m00 = matrix[0];
m10 = matrix[1];
@@ -316,25 +316,25 @@ public class AffineTransform implements Cloneable, Serializable {
}
public static <T extends Vertex> AffineTransform getScaleInstance(Vertex.Factory<? extends Vertex> factory, float scx, float scY) {
- AffineTransform t = new AffineTransform(factory);
+ AffineTransform t = new AffineTransform(factory);
t.setToScale(scx, scY);
return t;
}
public static <T extends Vertex> AffineTransform getShearInstance(Vertex.Factory<? extends Vertex> factory, float shx, float shy) {
- AffineTransform t = new AffineTransform(factory);
+ AffineTransform t = new AffineTransform(factory);
t.setToShear(shx, shy);
return t;
}
public static <T extends Vertex> AffineTransform getRotateInstance(Vertex.Factory<? extends Vertex> factory, float angle) {
- AffineTransform t = new AffineTransform(factory);
+ AffineTransform t = new AffineTransform(factory);
t.setToRotation(angle);
return t;
}
public static <T extends Vertex> AffineTransform getRotateInstance(Vertex.Factory<? extends Vertex> factory, float angle, float x, float y) {
- AffineTransform t = new AffineTransform(factory);
+ AffineTransform t = new AffineTransform(factory);
t.setToRotation(angle, x, y);
return t;
}
@@ -391,7 +391,7 @@ public class AffineTransform implements Cloneable, Serializable {
throw new NoninvertibleTransformException(determinantIsZero);
}
return new AffineTransform(
- this.pointFactory,
+ this.pointFactory,
m11 / det, // m00
-m10 / det, // m10
-m01 / det, // m01
@@ -401,9 +401,9 @@ public class AffineTransform implements Cloneable, Serializable {
);
}
- public Vertex transform(Vertex src, Vertex dst) {
+ public Vertex transform(Vertex src, Vertex dst) {
if (dst == null) {
- dst = pointFactory.create();
+ dst = pointFactory.create();
}
float x = src.getX();
@@ -415,12 +415,12 @@ public class AffineTransform implements Cloneable, Serializable {
public void transform(Vertex[] src, int srcOff, Vertex[] dst, int dstOff, int length) {
while (--length >= 0) {
- Vertex srcPoint = src[srcOff++];
+ Vertex srcPoint = src[srcOff++];
float x = srcPoint.getX();
float y = srcPoint.getY();
Vertex dstPoint = dst[dstOff];
if (dstPoint == null) {
- throw new IllegalArgumentException("dst["+dstOff+"] is null");
+ throw new IllegalArgumentException("dst["+dstOff+"] is null");
}
dstPoint.setCoord(x * m00 + y * m01 + m02, x * m10 + y * m11 + m12);
dst[dstOff++] = dstPoint;
@@ -444,9 +444,9 @@ public class AffineTransform implements Cloneable, Serializable {
}
}
- public Vertex deltaTransform(Vertex src, Vertex dst) {
+ public Vertex deltaTransform(Vertex src, Vertex dst) {
if (dst == null) {
- dst = pointFactory.create();
+ dst = pointFactory.create();
}
float x = src.getX();
@@ -465,13 +465,13 @@ public class AffineTransform implements Cloneable, Serializable {
}
}
- public Vertex inverseTransform(Vertex src, Vertex dst) throws NoninvertibleTransformException {
+ public Vertex inverseTransform(Vertex src, Vertex dst) throws NoninvertibleTransformException {
float det = getDeterminant();
if (MathFloat.abs(det) < ZERO) {
- throw new NoninvertibleTransformException(determinantIsZero);
+ throw new NoninvertibleTransformException(determinantIsZero);
}
if (dst == null) {
- dst = pointFactory.create();
+ dst = pointFactory.create();
}
float x = src.getX() - m02;
@@ -486,7 +486,7 @@ public class AffineTransform implements Cloneable, Serializable {
{
float det = getDeterminant();
if (MathFloat.abs(det) < ZERO) {
- throw new NoninvertibleTransformException(determinantIsZero);
+ throw new NoninvertibleTransformException(determinantIsZero);
}
while (--length >= 0) {
diff --git a/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java b/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java
index 4318913..edeabaa 100644
--- a/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java
+++ b/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java
@@ -243,11 +243,11 @@ public final class Path2D implements Cloneable {
}
final public int size() {
- return typeSize;
+ return typeSize;
}
final public boolean isClosed() {
- return typeSize > 0 && types[typeSize - 1] == PathIterator.SEG_CLOSE ;
+ return typeSize > 0 && types[typeSize - 1] == PathIterator.SEG_CLOSE ;
}
public void closePath() {
@@ -258,7 +258,7 @@ public final class Path2D implements Cloneable {
}
public String toString() {
- return "[size "+size()+", closed "+isClosed()+"]";
+ return "[size "+size()+", closed "+isClosed()+"]";
}
public void append(Path2D path, boolean connect) {
diff --git a/src/jogl/classes/jogamp/graph/math/plane/Crossing.java b/src/jogl/classes/jogamp/graph/math/plane/Crossing.java
index 8f86386..2138b21 100644
--- a/src/jogl/classes/jogamp/graph/math/plane/Crossing.java
+++ b/src/jogl/classes/jogamp/graph/math/plane/Crossing.java
@@ -385,12 +385,12 @@ public class Crossing {
// START
if (x == x1) {
- return x1 < x2 ? 0 : -1;
+ return x1 < x2 ? 0 : -1;
}
// END
if (x == x2) {
- return x1 < x2 ? 1 : 0;
+ return x1 < x2 ? 1 : 0;
}
// INSIDE-DOWN
@@ -496,9 +496,9 @@ public class Crossing {
// checks if the point (x,y) is the vertex of shape with PathIterator p
if (x == cx && y == cy) {
- cross = 0;
- cy = my;
- break;
+ cross = 0;
+ cy = my;
+ break;
}
p.next();
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java
index 5eb73cd..3f8a765 100644
--- a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java
+++ b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java
@@ -223,7 +223,7 @@ public class GLUquadricImpl implements GLUquadric {
* GLU.LINE: Quadrics are rendered as a set of lines.
*
* GLU.SILHOUETTE: Quadrics are rendered as a set of lines, except that edges
- * separating coplanar faces will not be drawn.
+ * separating coplanar faces will not be drawn.
*
* GLU.POINT: Quadrics are rendered as a set of points.
*
@@ -234,8 +234,8 @@ public class GLUquadricImpl implements GLUquadric {
}
/**
- * specifies what kind of normals are desired for quadrics.
- * The legal values are as follows:
+ * specifies what kind of normals are desired for quadrics.
+ * The legal values are as follows:
*
* GLU.NONE: No normals are generated.
*
@@ -252,7 +252,7 @@ public class GLUquadricImpl implements GLUquadric {
/**
* specifies what kind of orientation is desired for.
- * The orientation values are as follows:
+ * The orientation values are as follows:
*
* GLU.OUTSIDE: Quadrics are drawn with normals pointing outward.
*
@@ -495,10 +495,10 @@ public class GLUquadricImpl implements GLUquadric {
glNormal3f(gl, 0.0f, 0.0f, -1.0f);
}
}
-
+
da = 2.0f * PI / slices;
dr = (outerRadius - innerRadius) / loops;
-
+
switch (drawStyle) {
case GLU.GLU_FILL:
{
@@ -916,7 +916,7 @@ public class GLUquadricImpl implements GLUquadric {
}
/**
- * draws a sphere of the given radius centered around the origin.
+ * draws a sphere of the given radius centered around the origin.
* The sphere is subdivided around the z axis into slices and along the z axis
* into stacks (similar to lines of longitude and latitude).
*
@@ -1188,7 +1188,7 @@ public class GLUquadricImpl implements GLUquadric {
*/
private void normal3f(GL gl, float x, float y, float z) {
float mag;
-
+
mag = (float)Math.sqrt(x * x + y * y + z * z);
if (mag > 0.00001F) {
x /= mag;
diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java
index 043edac..2ef4468 100644
--- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java
+++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java
@@ -131,7 +131,7 @@ class GL2CurveEvaluator implements CurveEvaluator {
CArrayOfFloats ps) {
if (output_triangles) {
// TODO code for callback (output_triangles probably indicates callback)
- // System.out.println("TODO curveevaluator.map1f-output_triangles");
+ // System.out.println("TODO curveevaluator.map1f-output_triangles");
} else {
gl.glMap1f(type, ulo, uhi, stride, order, ps.getArray(), ps
.getPointer());
@@ -166,10 +166,10 @@ class GL2CurveEvaluator implements CurveEvaluator {
*/
public void mapgrid1f(int nu, float u1, float u2) {
if (output_triangles) {
- // System.out.println("TODO curveevaluator.mapgrid1f");
+ // System.out.println("TODO curveevaluator.mapgrid1f");
} else
gl.glMapGrid1f(nu, u1, u2);
- // // System.out.println("upravit NU");
+ // // System.out.println("upravit NU");
// gl.glMapGrid1f(50,u1,u2);
}
@@ -189,7 +189,7 @@ class GL2CurveEvaluator implements CurveEvaluator {
*/
if (output_triangles) {
// TODO code for callback
- // System.out.println("TODO openglcurveevaluator.mapmesh1f output_triangles");
+ // System.out.println("TODO openglcurveevaluator.mapmesh1f output_triangles");
} else {
switch (style) {
case Backend.N_MESHFILL:
diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java
index bc63994..155c4f9 100644
--- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java
+++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java
@@ -76,10 +76,10 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator {
if (output_triangles) {
// TODO outp triangles surfaceevaluator bgnmap2f
- // System.out.println("TODO surfaceevaluator.bgnmap2f output triangles");
+ // System.out.println("TODO surfaceevaluator.bgnmap2f output triangles");
} else {
gl.glPushAttrib(GL2.GL_EVAL_BIT);
- // System.out.println("TODO surfaceevaluator.bgnmap2f glgetintegerv");
+ // System.out.println("TODO surfaceevaluator.bgnmap2f glgetintegerv");
}
}
@@ -112,7 +112,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator {
public void endmap2f() {
// TODO Auto-generated method stub
if (output_triangles) {
- // System.out.println("TODO surfaceevaluator.endmap2f output triangles");
+ // System.out.println("TODO surfaceevaluator.endmap2f output triangles");
} else {
gl.glPopAttrib();
// TODO use LOD
@@ -142,7 +142,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator {
public void mapgrid2f(int nu, float u0, float u1, int nv, float v0, float v1) {
if (output_triangles) {
- // System.out.println("TODO openglsurfaceavaluator.mapgrid2f output_triangles");
+ // System.out.println("TODO openglsurfaceavaluator.mapgrid2f output_triangles");
} else {
gl.glMapGrid2d(nu, u0, u1, nv, v0, v1);
}
@@ -159,7 +159,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator {
*/
public void mapmesh2f(int style, int umin, int umax, int vmin, int vmax) {
if (output_triangles) {
- // System.out.println("TODO openglsurfaceavaluator.mapmesh2f output_triangles");
+ // System.out.println("TODO openglsurfaceavaluator.mapmesh2f output_triangles");
} else {
/* //DEBUG - draw control points
this.poradi++;
@@ -199,7 +199,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator {
float vlo, float vhi, int vstride, int vorder, CArrayOfFloats pts) {
// TODO Auto-generated method stub
if (output_triangles) {
- // System.out.println("TODO openglsurfaceevaluator.map2f output_triangles");
+ // System.out.println("TODO openglsurfaceevaluator.map2f output_triangles");
} else {
gl.glMap2f(type, ulo, uhi, ustride, uorder, vlo, vhi, vstride,
vorder, pts.getArray(), pts.getPointer());
diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java
index bd0eaf7..58b5654 100644
--- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java
+++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java
@@ -442,7 +442,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
// TODO errval ??
if (numTrims > 0) {
- // System.out.println("TODO glunurbs.do_endsurface - numtrims > 0");
+ // System.out.println("TODO glunurbs.do_endsurface - numtrims > 0");
}
subdivider.beginQuilts(new GL2Backend());
@@ -461,7 +461,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
*/
public void do_endcurve() {
// DONE
- // // System.out.println("do_endcurve");
+ // // System.out.println("do_endcurve");
if (inCurve <= 0) {
do_nurbserror(7);
return;
@@ -509,7 +509,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
*/
private void do_nurbserror(int i) {
// TODO nurberror
- // System.out.println("TODO nurbserror " + i);
+ // System.out.println("TODO nurbserror " + i);
}
/**
@@ -527,7 +527,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
*/
private void loadGLMatrices() {
// TODO Auto-generated method stub
- // System.out.println("TODO glunurbs.loadGLMatrices");
+ // System.out.println("TODO glunurbs.loadGLMatrices");
}
/**
@@ -783,7 +783,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
// DONE
O_surface o_surface = new O_surface();
// TODO nuid
- // System.out.println("TODO glunurbs.bgnsurface nuid");
+ // System.out.println("TODO glunurbs.bgnsurface nuid");
thread("do_bgnsurface", o_surface);
}
@@ -800,7 +800,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
*/
private void endtrim() {
// TODO Auto-generated method stub
- // System.out.println("TODO glunurbs.endtrim");
+ // System.out.println("TODO glunurbs.endtrim");
}
/**
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java
index 0d04d4c..f4ad701 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java
@@ -47,7 +47,7 @@ public class ArcSdirSorter {
*/
public ArcSdirSorter(Subdivider subdivider) {
//TODO
- // System.out.println("TODO arcsdirsorter.constructor");
+ // System.out.println("TODO arcsdirsorter.constructor");
}
/**
@@ -57,7 +57,7 @@ public class ArcSdirSorter {
*/
public void qsort(CArrayOfArcs list, int count) {
// TODO
- // System.out.println("TODO arcsdirsorter.qsort");
+ // System.out.println("TODO arcsdirsorter.qsort");
}
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java
index bee98b8..be72c53 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java
@@ -46,7 +46,7 @@ public class ArcTdirSorter {
*/
public ArcTdirSorter(Subdivider subdivider) {
// TODO Auto-generated constructor stub
- // System.out.println("TODO arcTsorter.konstruktor");
+ // System.out.println("TODO arcTsorter.konstruktor");
}
/**
* Sorts list of arcs
@@ -55,6 +55,6 @@ public class ArcTdirSorter {
*/
public void qsort(CArrayOfArcs list, int count) {
// TODO Auto-generated method stub
- // System.out.println("TODO arcTsorter.qsort");
+ // System.out.println("TODO arcTsorter.qsort");
}
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java
index 2e4d3eb..bd63114 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java
@@ -72,7 +72,7 @@ public class ArcTesselator {
*/
public void pwl_right(Arc newright, float s, float t1, float t2, float f) {
// TODO Auto-generated method stub
- // System.out.println("TODO arctesselator.pwl_right");
+ // System.out.println("TODO arctesselator.pwl_right");
}
/**
@@ -85,6 +85,6 @@ public class ArcTesselator {
*/
public void pwl_left(Arc newright, float s, float t2, float t1, float f) {
// TODO Auto-generated method stub
- // System.out.println("TODO arctesselator.pwl_left");
+ // System.out.println("TODO arctesselator.pwl_left");
}
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java
index 4959f80..610a195 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java
@@ -188,7 +188,7 @@ public abstract class Backend {
* @param m step in v direction
*/
public void surfmesh(int u, int v, int n, int m) {
- // System.out.println("TODO backend.surfmesh wireframequads");
+ // System.out.println("TODO backend.surfmesh wireframequads");
// TODO wireframequads
surfaceEvaluator.mapmesh2f(NurbsConsts.N_MESHFILL, u, u + n, v, v + m);
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java
index b0ff4e6..7867817 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java
@@ -135,7 +135,7 @@ public class Curve {
stride);
}
if (cullval == Subdivider.CULL_ACCEPT) {
- // System.out.println("TODO curve.Curve-cullval");
+ // System.out.println("TODO curve.Curve-cullval");
// mapdesc.xformCulling(ps,qs.get().order,qs.get().stride,cpts,stride);
}
@@ -145,13 +145,13 @@ public class Curve {
range[2] = range[1] - range[0];
// TODO it is necessary to solve problem with "this" pointer here
if (range[0] != pta[0]) {
- // System.out.println("TODO curve.Curve-range0");
+ // System.out.println("TODO curve.Curve-range0");
// Curve lower=new Curve(this,pta,0);
// lower.next=next;
// this=lower;
}
if (range[1] != ptb[0]) {
- // System.out.println("TODO curve.Curve-range1");
+ // System.out.println("TODO curve.Curve-range1");
// Curve lower=new Curve(this,ptb,0);
}
}
@@ -162,7 +162,7 @@ public class Curve {
*/
public int cullCheck() {
if (cullval == Subdivider.CULL_ACCEPT) {
- // System.out.println("TODO curve.cullval");
+ // System.out.println("TODO curve.cullval");
// cullval=mapdesc.cullCheck(cpts,order,stride);
}
// TODO compute cullval and return the computed value
@@ -189,16 +189,16 @@ public class Curve {
int val = 0;
// mapdesc.project(spts,stride,tmp,tstride,order);
- // System.out.println("TODO curve.getsptepsize mapdesc.project");
+ // System.out.println("TODO curve.getsptepsize mapdesc.project");
if (val == 0) {
setstepsize(mapdesc.maxrate);
} else {
float t = mapdesc.getProperty(NurbsConsts.N_PIXEL_TOLERANCE);
if (mapdesc.isParametricDistanceSampling()) {
- // System.out.println("TODO curve.getstepsize - parametric");
+ // System.out.println("TODO curve.getstepsize - parametric");
} else if (mapdesc.isPathLengthSampling()) {
- // System.out.println("TODO curve.getstepsize - pathlength");
+ // System.out.println("TODO curve.getstepsize - pathlength");
} else {
setstepsize(mapdesc.maxrate);
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java
index 5c80ffd..d9d0126 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java
@@ -51,6 +51,6 @@ public class DisplayList {
*/
public void append(Object src, Method m, Object arg) {
// TODO Auto-generated method stub
- // System.out.println("TODO displaylist append");
+ // System.out.println("TODO displaylist append");
}
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java
index 4f97b12..114832a 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java
@@ -366,7 +366,7 @@ public class Knotspec {
break;
default:
// TODO break with copying in general case
- // System.out.println("TODO knotspec.pt_io_copy");
+ // System.out.println("TODO knotspec.pt_io_copy");
break;
}
@@ -388,7 +388,7 @@ public class Knotspec {
if (istransformed) {
p.raisePointerBy(postoffset);
for (CArrayOfFloats pend = new CArrayOfFloats(p.getArray(),
- p.getPointer() + postwidth); p.getPointer() != pend
+ p.getPointer() + postwidth); p.getPointer() != pend
.getPointer(); p.raisePointerBy(poststride))
next.transform(p);
@@ -409,7 +409,7 @@ public class Knotspec {
if (istransformed) {
p.raisePointerBy(postoffset);
for (CArrayOfFloats pend = new CArrayOfFloats(p.getArray(),
- p.getPointer() + postwidth); p.getPointer() != pend
+ p.getPointer() + postwidth); p.getPointer() != pend
.getPointer(); p.raisePointerBy(poststride)) {
kspectotrans.insert(p);
}
@@ -549,8 +549,8 @@ public class Knotspec {
* z.getRelative(0)));
break;
default:
- //no need of default - see previous method and its case statement
- // System.out.println("TODO pt_oo_sum default");
+ //no need of default - see previous method and its case statement
+ // System.out.println("TODO pt_oo_sum default");
break;
}
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java
index 89389de..aac4dfc 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java
@@ -160,7 +160,7 @@ public class Knotvector {
*/
public void show(String msg) {
// TODO Auto-generated method stub
- // System.out.println("TODO knotvector.show");
+ // System.out.println("TODO knotvector.show");
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java
index 8fab114..bd5d2db 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java
@@ -349,7 +349,7 @@ public class Mapdesc {
*/
public float getProperty(int tag) {
// TODO Auto-generated method stub
- // System.out.println("TODO mapdesc.getproperty");
+ // System.out.println("TODO mapdesc.getproperty");
return 0;
}
@@ -428,10 +428,10 @@ public class Mapdesc {
* @param outstride output number of control points' coordinates
*/
private void xFormMat(float[][] mat, CArrayOfFloats pts, int order,
- int stride, float[] cp, int outstride) {
+ int stride, float[] cp, int outstride) {
// TODO Auto-generated method stub
- // System.out.println("TODO mapdsc.xformmat ; change cp from float[] to carrayoffloats");
+ // System.out.println("TODO mapdsc.xformmat ; change cp from float[] to carrayoffloats");
if (isrational > 0) {
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java
index 51c43fc..a44f245 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java
@@ -49,6 +49,6 @@ public class Patch {
* @param patch
*/
public Patch(Quilt q, float[] pta, float[] ptb, Patch patch) {
- // System.out.println("TODO patch.constructor");
+ // System.out.println("TODO patch.constructor");
}
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java
index f60a0cc..f1e499a 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java
@@ -82,7 +82,7 @@ public class Patchlist {
*/
public Patchlist(Patchlist patchlist, int param, float mid) {
// TODO Auto-generated constructor stub
- // System.out.println("TODO patchlist.konstruktor 2");
+ // System.out.println("TODO patchlist.konstruktor 2");
}
/**
@@ -91,7 +91,7 @@ public class Patchlist {
*/
public int cullCheck() {
// TODO Auto-generated method stub
- // System.out.println("TODO patchlist.cullcheck");
+ // System.out.println("TODO patchlist.cullcheck");
return 0;
}
@@ -99,7 +99,7 @@ public class Patchlist {
* Empty method
*/
public void getstepsize() {
- // System.out.println("TODO patchlist.getsptepsize");
+ // System.out.println("TODO patchlist.getsptepsize");
// TODO Auto-generated method stub
}
@@ -110,7 +110,7 @@ public class Patchlist {
*/
public boolean needsSamplingSubdivision() {
// TODO Auto-generated method stub
- // System.out.println("patchlist.needsSamplingSubdivision");
+ // System.out.println("patchlist.needsSamplingSubdivision");
return false;
}
@@ -121,7 +121,7 @@ public class Patchlist {
*/
public boolean needsSubdivision(int i) {
// TODO Auto-generated method stub
- // System.out.println("TODO patchlist.needsSubdivision");
+ // System.out.println("TODO patchlist.needsSubdivision");
return false;
}
@@ -131,7 +131,7 @@ public class Patchlist {
*/
public boolean needsNonSamplingSubdivision() {
// TODO Auto-generated method stub
- // System.out.println("TODO patchlist.needsNonSamplingSubdivision");
+ // System.out.println("TODO patchlist.needsNonSamplingSubdivision");
return false;
}
@@ -140,6 +140,6 @@ public class Patchlist {
*/
public void bbox() {
// TODO Auto-generated method stub
- // System.out.println("TODO patchlist.bbox");
+ // System.out.println("TODO patchlist.bbox");
}
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java
index 6d732a4..6bea492 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java
@@ -248,7 +248,7 @@ public class Quilt {
*/
public int isCulled() {
if (mapdesc.isCulling()) {
- // System.out.println("TODO quilt.isculled mapdesc.isculling");
+ // System.out.println("TODO quilt.isculled mapdesc.isculling");
return 0;
} else {
return Subdivider.CULL_ACCEPT;
@@ -277,6 +277,6 @@ public class Quilt {
*/
public void findRates(Flist sbrkpts, Flist tbrkpts, float[] rate) {
// TODO Auto-generated method stub
- // System.out.println("TODO quilt.findrates");
+ // System.out.println("TODO quilt.findrates");
}
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/README.txt b/src/jogl/classes/jogamp/opengl/glu/nurbs/README.txt
index 89630c7..7f80e56 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/README.txt
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/README.txt
@@ -1,59 +1,59 @@
Unimplemented functionality
- - tesselation and callbacks
- - trimming
- - setting NURBS properties (-> sampling etc.)
+ - tesselation and callbacks
+ - trimming
+ - setting NURBS properties (-> sampling etc.)
Differences from C++ source
- - no pooling
- - pointers to arrays are replaced by CArrayOf... classes and their methods
+ - no pooling
+ - pointers to arrays are replaced by CArrayOf... classes and their methods
Unimplemented or incomplete "calltree top" methods (according to glu.def in Mesa 6.5)
- gluBeginTrim
- gluDeleteNurbsRenderer - won't be needed
- gluEndTrim
- gluGetNurbsProperty
- gluLoadSamplingMatrices
- gluNurbsCallback
- gluNurbsCallbackData
- gluNurbsCallbackDataEXT
- gluNurbsCurve - TODO type switch
- gluNurbsProperty
- gluPwlCurve
- gluQuadricCallback - not a NURBS method
+ gluBeginTrim
+ gluDeleteNurbsRenderer - won't be needed
+ gluEndTrim
+ gluGetNurbsProperty
+ gluLoadSamplingMatrices
+ gluNurbsCallback
+ gluNurbsCallbackData
+ gluNurbsCallbackDataEXT
+ gluNurbsCurve - TODO type switch
+ gluNurbsProperty
+ gluPwlCurve
+ gluQuadricCallback - not a NURBS method
As of files
- - Arc[ST]dirSorter.java - unimplemented (part of tesselation)
- - Backend.java:194 - wireframe quads - part of tesselation/callback
- - Curve.java:141-204 - culling
- - DisplayList.java:57 - append to DL - not sure whether it will be needed
- - GLUnurbs.java :443,484 - error values
- :445 - trimming
- :512 - error handling (callback)
- :530 - loadGLmatrices
- :786 - nuid - nurbs object id - won't be needed I think
- :803 - end trim
- - GLUwNURBS.java:68,176 - NUBRS properties
- - Knotspec.java :371 - copying in general case (more than 4 coords)
- :517 - copying with more than 4 coords
- :556 - pt_oo_sum default
- - Knotvector.java:165 - show method (probably debugging)
- - Mapdesc.java :354 - get property
- :435 - xFormMat - change param cp to CArrayOfFloats; probably sampling functionality
- - Maplist.java:68 - clear ?
- - OpenGLCurveEvaluator.java :132 - tess./callback code
- :168 - mapgrid1f
- :190 - tess./callback code (output triangles)
- - OpenGLSurfaceEvaluator.java :77 . tess./callback code
- :81 - glGetIntegerValue
- :114 - tess./callback code
- :117 - Level of detail
- :144,161,201 - tess./callback code - output triangles
- - Patch.java:55 - constructor stuff ?
- - Patchlist.java:55 - constructor stuff ?
- :97 - cull check
- :105 - step size
- :115 - need of sampling subdivision
- :126 - need of subdivision
- :137 - need of non sampling subd.
- :146 - bbox (??)
- -Quilt.java :254 - culling
- :282 - rates
- -Subdivider.java - all TODOs - it's stuff about trimming probably
- :545 - jumpbuffer - not sure purpose it exactly served in original source
+ - Arc[ST]dirSorter.java - unimplemented (part of tesselation)
+ - Backend.java:194 - wireframe quads - part of tesselation/callback
+ - Curve.java:141-204 - culling
+ - DisplayList.java:57 - append to DL - not sure whether it will be needed
+ - GLUnurbs.java :443,484 - error values
+ :445 - trimming
+ :512 - error handling (callback)
+ :530 - loadGLmatrices
+ :786 - nuid - nurbs object id - won't be needed I think
+ :803 - end trim
+ - GLUwNURBS.java:68,176 - NUBRS properties
+ - Knotspec.java :371 - copying in general case (more than 4 coords)
+ :517 - copying with more than 4 coords
+ :556 - pt_oo_sum default
+ - Knotvector.java:165 - show method (probably debugging)
+ - Mapdesc.java :354 - get property
+ :435 - xFormMat - change param cp to CArrayOfFloats; probably sampling functionality
+ - Maplist.java:68 - clear ?
+ - OpenGLCurveEvaluator.java :132 - tess./callback code
+ :168 - mapgrid1f
+ :190 - tess./callback code (output triangles)
+ - OpenGLSurfaceEvaluator.java :77 . tess./callback code
+ :81 - glGetIntegerValue
+ :114 - tess./callback code
+ :117 - Level of detail
+ :144,161,201 - tess./callback code - output triangles
+ - Patch.java:55 - constructor stuff ?
+ - Patchlist.java:55 - constructor stuff ?
+ :97 - cull check
+ :105 - step size
+ :115 - need of sampling subdivision
+ :126 - need of subdivision
+ :137 - need of non sampling subd.
+ :146 - bbox (??)
+ -Quilt.java :254 - culling
+ :282 - rates
+ -Subdivider.java - all TODOs - it's stuff about trimming probably
+ :545 - jumpbuffer - not sure purpose it exactly served in original source
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java
index 3378dba..37774f8 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java
@@ -187,7 +187,7 @@ public class Subdivider {
renderhints.init();
if (qlist == null) {
- // System.out.println("qlist is null");
+ // System.out.println("qlist is null");
return;
}
@@ -217,7 +217,7 @@ public class Subdivider {
} else {
float[] rate = new float[2];
qlist.findRates(spbrkpts, tpbrkpts, rate);
- // System.out.println("subdivider.drawsurfaces decompose");
+ // System.out.println("subdivider.drawsurfaces decompose");
}
backend.bgnsurf(renderhints.wiretris, renderhints.wirequads);
@@ -268,7 +268,7 @@ public class Subdivider {
*/
private void freejarcs(Bin initialbin2) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.freejarcs");
+ // System.out.println("TODO subdivider.freejarcs");
}
/**
@@ -319,7 +319,7 @@ public class Subdivider {
}
}
} else{
- // System.out.println("Source is empty - subdivider.splitins");
+ // System.out.println("Source is empty - subdivider.splitins");
}
}
@@ -331,7 +331,7 @@ public class Subdivider {
*/
private void splitInT(Bin source, int start, int end) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.splitint");
+ // System.out.println("TODO subdivider.splitint");
if (source.isnonempty()) {
if (start != end) {
@@ -485,7 +485,7 @@ public class Subdivider {
*/
private void monosplitInS(Bin source, int start, int end) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.monosplitins");
+ // System.out.println("TODO subdivider.monosplitins");
}
/**
@@ -494,7 +494,7 @@ public class Subdivider {
*/
private void findIrregularS(Bin source) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.findIrregularS");
+ // System.out.println("TODO subdivider.findIrregularS");
}
/**
@@ -502,7 +502,7 @@ public class Subdivider {
*/
private void setArcTypePwl() {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.setarctypepwl");
+ // System.out.println("TODO subdivider.setarctypepwl");
}
/**
@@ -512,7 +512,7 @@ public class Subdivider {
*/
private void tesselation(Bin source, Patchlist patchlist) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.tesselation");
+ // System.out.println("TODO subdivider.tesselation");
}
/**
@@ -520,7 +520,7 @@ public class Subdivider {
*/
private void setDegenerate() {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.setdegenerate");
+ // System.out.println("TODO subdivider.setdegenerate");
}
/**
@@ -611,7 +611,7 @@ public class Subdivider {
*/
private void join_t(Bin left, Bin right, Arc arc, Arc relative) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.join_t");
+ // System.out.println("TODO subdivider.join_t");
}
/**
@@ -621,7 +621,7 @@ public class Subdivider {
*/
private void check_t(Arc arc, Arc relative) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.check_t");
+ // System.out.println("TODO subdivider.check_t");
}
/**
@@ -670,7 +670,7 @@ public class Subdivider {
*/
private void link(Arc jarc1, Arc jarc2, Arc newright, Arc newleft) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.link");
+ // System.out.println("TODO subdivider.link");
}
/**
@@ -679,7 +679,7 @@ public class Subdivider {
*/
private boolean isBezierArcType() {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.isbezierarc");
+ // System.out.println("TODO subdivider.isbezierarc");
return true;
}
@@ -690,7 +690,7 @@ public class Subdivider {
*/
private void simplelink(Arc jarc1, Arc jarc2) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.simplelink");
+ // System.out.println("TODO subdivider.simplelink");
}
/**
@@ -700,7 +700,7 @@ public class Subdivider {
*/
private void check_s(Arc arc, Arc relative) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.check_s");
+ // System.out.println("TODO subdivider.check_s");
}
@@ -756,7 +756,7 @@ public class Subdivider {
} else {
if (hdiff > 0) {
// TODO rest
- // System.out.println("TODO subdivider.partition rest of else");
+ // System.out.println("TODO subdivider.partition rest of else");
} else if (hdiff == 0) {
tailonleft.addarc(jarc);
} else {
@@ -788,7 +788,7 @@ public class Subdivider {
private void classify_tailonright_t(Bin tailonright, Bin intersections,
Bin right, float value) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.classify_tailonright_t");
+ // System.out.println("TODO subdivider.classify_tailonright_t");
}
@@ -862,7 +862,7 @@ public class Subdivider {
*/
private boolean ccwTurn_sr(Arc prev, Arc j) {
// TODO Auto-generated method stub
- // System.out.println("TODO ccwTurn_sr");
+ // System.out.println("TODO ccwTurn_sr");
return false;
}
@@ -876,7 +876,7 @@ public class Subdivider {
private void classify_headonright_t(Bin headonright, Bin intersections,
Bin right, float value) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.classify_headonright_t");
+ // System.out.println("TODO subdivider.classify_headonright_t");
}
/**
@@ -889,7 +889,7 @@ public class Subdivider {
private void classify_tailonleft_t(Bin tailonleft, Bin intersections,
Bin left, float value) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.classify_tailonleft_t");
+ // System.out.println("TODO subdivider.classify_tailonleft_t");
}
/**
@@ -930,7 +930,7 @@ public class Subdivider {
*/
private boolean ccwTurn_tl(Arc prev, Arc j) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.ccwTurn_tl");
+ // System.out.println("TODO subdivider.ccwTurn_tl");
return false;
}
@@ -1004,7 +1004,7 @@ public class Subdivider {
*/
private boolean ccwTurn_sl(Arc prev, Arc j) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.ccwTurn_sl");
+ // System.out.println("TODO subdivider.ccwTurn_sl");
return false;
}
@@ -1018,7 +1018,7 @@ public class Subdivider {
*/
private int arc_split(Arc jarc, int param, float value, int i) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.arc_split");
+ // System.out.println("TODO subdivider.arc_split");
return 0;
}
@@ -1045,7 +1045,7 @@ public class Subdivider {
*/
private void outline(Bin source) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.outline");
+ // System.out.println("TODO subdivider.outline");
}
/**
@@ -1128,7 +1128,7 @@ public class Subdivider {
if (curvelist.needsSamplingSubdivision() && (subdivisions > 0)) {
// TODO kód
- // System.out.println("TODO subdivider-needsSamplingSubdivision");
+ // System.out.println("TODO subdivider-needsSamplingSubdivision");
} else {
int nu = (int) (1 + curvelist.range[2] / curvelist.stepsize);
backend.curvgrid(curvelist.range[0], curvelist.range[1], nu);
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/ActiveRegion.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/ActiveRegion.java
index 13c226a..17f5830 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/ActiveRegion.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/ActiveRegion.java
@@ -54,16 +54,16 @@ package jogamp.opengl.glu.tessellator;
class ActiveRegion {
- GLUhalfEdge eUp; /* upper edge, directed right to left */
- DictNode nodeUp; /* dictionary node corresponding to eUp */
- int windingNumber; /* used to determine which regions are
+ GLUhalfEdge eUp; /* upper edge, directed right to left */
+ DictNode nodeUp; /* dictionary node corresponding to eUp */
+ int windingNumber; /* used to determine which regions are
* inside the polygon */
- boolean inside; /* is this region inside the polygon? */
- boolean sentinel; /* marks fake edges at t = +/-infinity */
- boolean dirty; /* marks regions where the upper or lower
+ boolean inside; /* is this region inside the polygon? */
+ boolean sentinel; /* marks fake edges at t = +/-infinity */
+ boolean dirty; /* marks regions where the upper or lower
* edge has changed, but we haven't checked
* whether they intersect yet */
- boolean fixUpperEdge; /* marks temporary edges introduced when
+ boolean fixUpperEdge; /* marks temporary edges introduced when
* we process a "right vertex" (one without
* any edges leaving to the right) */
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUface.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUface.java
index b15bf71..892722d 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUface.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUface.java
@@ -53,13 +53,13 @@
package jogamp.opengl.glu.tessellator;
class GLUface {
- public GLUface next; /* next face (never NULL) */
- public GLUface prev; /* previous face (never NULL) */
- public GLUhalfEdge anEdge; /* a half edge with this left face */
- public Object data; /* room for client's data */
+ public GLUface next; /* next face (never NULL) */
+ public GLUface prev; /* previous face (never NULL) */
+ public GLUhalfEdge anEdge; /* a half edge with this left face */
+ public Object data; /* room for client's data */
/* Internal data (keep hidden) */
- public GLUface trail; /* "stack" for conversion to strips */
- public boolean marked; /* flag for conversion to strips */
- public boolean inside; /* this face is in the polygon interior */
+ public GLUface trail; /* "stack" for conversion to strips */
+ public boolean marked; /* flag for conversion to strips */
+ public boolean inside; /* this face is in the polygon interior */
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java
index 385a438..29944f9 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java
@@ -53,16 +53,16 @@
package jogamp.opengl.glu.tessellator;
class GLUhalfEdge {
- public GLUhalfEdge next; /* doubly-linked list (prev==Sym->next) */
- public GLUhalfEdge Sym; /* same edge, opposite direction */
- public GLUhalfEdge Onext; /* next edge CCW around origin */
- public GLUhalfEdge Lnext; /* next edge CCW around left face */
- public GLUvertex Org; /* origin vertex (Overtex too long) */
- public jogamp.opengl.glu.tessellator.GLUface Lface; /* left face */
+ public GLUhalfEdge next; /* doubly-linked list (prev==Sym->next) */
+ public GLUhalfEdge Sym; /* same edge, opposite direction */
+ public GLUhalfEdge Onext; /* next edge CCW around origin */
+ public GLUhalfEdge Lnext; /* next edge CCW around left face */
+ public GLUvertex Org; /* origin vertex (Overtex too long) */
+ public jogamp.opengl.glu.tessellator.GLUface Lface; /* left face */
/* Internal data (keep hidden) */
- public jogamp.opengl.glu.tessellator.ActiveRegion activeRegion; /* a region with this upper edge (sweep.c) */
- public int winding; /* change in winding number when crossing */
+ public jogamp.opengl.glu.tessellator.ActiveRegion activeRegion; /* a region with this upper edge (sweep.c) */
+ public int winding; /* change in winding number when crossing */
public boolean first;
public GLUhalfEdge(boolean first) {
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUmesh.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUmesh.java
index dfdf5be..10af743 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUmesh.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUmesh.java
@@ -53,8 +53,8 @@
package jogamp.opengl.glu.tessellator;
class GLUmesh {
- GLUvertex vHead = new GLUvertex(); /* dummy header for vertex list */
- jogamp.opengl.glu.tessellator.GLUface fHead = new GLUface(); /* dummy header for face list */
- jogamp.opengl.glu.tessellator.GLUhalfEdge eHead = new GLUhalfEdge(true); /* dummy header for edge list */
- jogamp.opengl.glu.tessellator.GLUhalfEdge eHeadSym = new GLUhalfEdge(false); /* and its symmetric counterpart */
+ GLUvertex vHead = new GLUvertex(); /* dummy header for vertex list */
+ jogamp.opengl.glu.tessellator.GLUface fHead = new GLUface(); /* dummy header for face list */
+ jogamp.opengl.glu.tessellator.GLUhalfEdge eHead = new GLUhalfEdge(true); /* dummy header for edge list */
+ jogamp.opengl.glu.tessellator.GLUhalfEdge eHeadSym = new GLUhalfEdge(false); /* and its symmetric counterpart */
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java
index 182820b..d594cb3 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java
@@ -59,32 +59,32 @@ import javax.media.opengl.glu.*;
public class GLUtessellatorImpl implements GLUtessellator {
public static final int TESS_MAX_CACHE = 100;
- private int state; /* what begin/end calls have we seen? */
+ private int state; /* what begin/end calls have we seen? */
- private GLUhalfEdge lastEdge; /* lastEdge->Org is the most recent vertex */
- GLUmesh mesh; /* stores the input contours, and eventually
+ private GLUhalfEdge lastEdge; /* lastEdge->Org is the most recent vertex */
+ GLUmesh mesh; /* stores the input contours, and eventually
the tessellation itself */
/*** state needed for projecting onto the sweep plane ***/
- double[] normal = new double[3]; /* user-specified normal (if provided) */
- double[] sUnit = new double[3]; /* unit vector in s-direction (debugging) */
- double[] tUnit = new double[3]; /* unit vector in t-direction (debugging) */
+ double[] normal = new double[3]; /* user-specified normal (if provided) */
+ double[] sUnit = new double[3]; /* unit vector in s-direction (debugging) */
+ double[] tUnit = new double[3]; /* unit vector in t-direction (debugging) */
/*** state needed for the line sweep ***/
- private double relTolerance; /* tolerance for merging features */
- int windingRule; /* rule for determining polygon interior */
- boolean fatalError; /* fatal error: needed combine callback */
+ private double relTolerance; /* tolerance for merging features */
+ int windingRule; /* rule for determining polygon interior */
+ boolean fatalError; /* fatal error: needed combine callback */
- Dict dict; /* edge dictionary for sweep line */
- PriorityQ pq; /* priority queue of vertex events */
- GLUvertex event; /* current sweep event being processed */
+ Dict dict; /* edge dictionary for sweep line */
+ PriorityQ pq; /* priority queue of vertex events */
+ GLUvertex event; /* current sweep event being processed */
/*** state needed for rendering callbacks (see render.c) ***/
- boolean flagBoundary; /* mark boundary edges (use EdgeFlag) */
- boolean boundaryOnly; /* Extract contours, not triangles */
+ boolean flagBoundary; /* mark boundary edges (use EdgeFlag) */
+ boolean boundaryOnly; /* Extract contours, not triangles */
boolean avoidDegenerateTris; /* JOGL-specific hint to try to improve triangulation
by avoiding producing degenerate (zero-area) triangles;
has not been tested exhaustively and is therefore an option */
@@ -96,12 +96,12 @@ public class GLUtessellatorImpl implements GLUtessellator {
/*** state needed to cache single-contour polygons for renderCache() */
- private boolean flushCacheOnNextVertex; /* empty cache on next vertex() call */
- int cacheCount; /* number of cached vertices */
- CachedVertex[] cache = new CachedVertex[TESS_MAX_CACHE]; /* the vertex data */
+ private boolean flushCacheOnNextVertex; /* empty cache on next vertex() call */
+ int cacheCount; /* number of cached vertices */
+ CachedVertex[] cache = new CachedVertex[TESS_MAX_CACHE]; /* the vertex data */
/*** rendering callbacks that also pass polygon data ***/
- private Object polygonData; /* client data for current polygon */
+ private Object polygonData; /* client data for current polygon */
private GLUtessellatorCallback callBegin;
private GLUtessellatorCallback callEdgeFlag;
@@ -120,10 +120,10 @@ public class GLUtessellatorImpl implements GLUtessellator {
private GLUtessellatorCallback callCombineData;
private static final double GLU_TESS_DEFAULT_TOLERANCE = 0.0;
-// private static final int GLU_TESS_MESH = 100112; /* void (*)(GLUmesh *mesh) */
+// private static final int GLU_TESS_MESH = 100112; /* void (*)(GLUmesh *mesh) */
private static GLUtessellatorCallback NULL_CB = new GLUtessellatorCallbackAdapter();
-// #define MAX_FAST_ALLOC (MAX(sizeof(EdgePair), \
+// #define MAX_FAST_ALLOC (MAX(sizeof(EdgePair), \
// MAX(sizeof(GLUvertex),sizeof(GLUface))))
private GLUtessellatorImpl() {
@@ -220,7 +220,7 @@ public class GLUtessellatorImpl implements GLUtessellator {
case GLU.GLU_TESS_WINDING_RULE:
int windingRule = (int) value;
- if (windingRule != value) break; /* not an integer */
+ if (windingRule != value) break; /* not an integer */
switch (windingRule) {
case GLU.GLU_TESS_WINDING_ODD:
@@ -523,7 +523,7 @@ public class GLUtessellatorImpl implements GLUtessellator {
* Each interior region is guaranteed be monotone.
*/
if (!Sweep.__gl_computeInterior(this)) {
- throw new RuntimeException(); /* could've used a label */
+ throw new RuntimeException(); /* could've used a label */
}
mesh = this.mesh;
@@ -539,7 +539,7 @@ public class GLUtessellatorImpl implements GLUtessellator {
} else {
rc = TessMono.__gl_meshTessellateInterior(mesh, avoidDegenerateTris);
}
- if (!rc) throw new RuntimeException(); /* could've used a label */
+ if (!rc) throw new RuntimeException(); /* could've used a label */
Mesh.__gl_meshCheckMesh(mesh);
@@ -552,7 +552,7 @@ public class GLUtessellatorImpl implements GLUtessellator {
if (boundaryOnly) {
Render.__gl_renderBoundary(this, mesh); /* output boundary contours */
} else {
- Render.__gl_renderMesh(this, mesh); /* output strips and fans */
+ Render.__gl_renderMesh(this, mesh); /* output strips and fans */
}
}
// if (callMesh != NULL_CB) {
@@ -564,7 +564,7 @@ public class GLUtessellatorImpl implements GLUtessellator {
// * faces in the first place.
// */
// TessMono.__gl_meshDiscardExterior(mesh);
-// callMesh.mesh(mesh); /* user wants the mesh itself */
+// callMesh.mesh(mesh); /* user wants the mesh itself */
// mesh = null;
// polygonData = null;
// return;
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUvertex.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUvertex.java
index c30d759..ecc91c2 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUvertex.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUvertex.java
@@ -53,13 +53,13 @@
package jogamp.opengl.glu.tessellator;
class GLUvertex {
- public GLUvertex next; /* next vertex (never NULL) */
- public GLUvertex prev; /* previous vertex (never NULL) */
- public jogamp.opengl.glu.tessellator.GLUhalfEdge anEdge; /* a half-edge with this origin */
- public Object data; /* client's data */
+ public GLUvertex next; /* next vertex (never NULL) */
+ public GLUvertex prev; /* previous vertex (never NULL) */
+ public jogamp.opengl.glu.tessellator.GLUhalfEdge anEdge; /* a half-edge with this origin */
+ public Object data; /* client's data */
/* Internal data (keep hidden) */
- public double[] coords = new double[3]; /* vertex location in 3D */
- public double s, t; /* projection onto the sweep plane */
- public int pqHandle; /* to allow deletion from priority queue */
+ public double[] coords = new double[3]; /* vertex location in 3D */
+ public double s, t; /* projection onto the sweep plane */
+ public int pqHandle; /* to allow deletion from priority queue */
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java
index 942dfe8..eb48aa5 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java
@@ -281,8 +281,8 @@ class Mesh {
/* __gl_meshSplice( eOrg, eDst ) is the basic operation for changing the
* mesh connectivity and topology. It changes the mesh so that
- * eOrg->Onext <- OLD( eDst->Onext )
- * eDst->Onext <- OLD( eOrg->Onext )
+ * eOrg->Onext <- OLD( eDst->Onext )
+ * eDst->Onext <- OLD( eOrg->Onext )
* where OLD(...) means the value before the meshSplice operation.
*
* This can have two effects on the vertex structure:
@@ -453,9 +453,9 @@ class Mesh {
/* Set the vertex and face information */
eOrg.Sym.Org = eNew.Org;
- eNew.Sym.Org.anEdge = eNew.Sym; /* may have pointed to eOrg.Sym */
+ eNew.Sym.Org.anEdge = eNew.Sym; /* may have pointed to eOrg.Sym */
eNew.Sym.Lface = eOrg.Sym.Lface;
- eNew.winding = eOrg.winding; /* copy old winding information */
+ eNew.winding = eOrg.winding; /* copy old winding information */
eNew.Sym.winding = eOrg.Sym.winding;
return eNew;
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java
index 7d5acd9..196e6cf 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java
@@ -60,7 +60,7 @@ class Normal {
}
static boolean SLANTED_SWEEP = false;
- static double S_UNIT_X; /* Pre-normalized */
+ static double S_UNIT_X; /* Pre-normalized */
static double S_UNIT_Y;
private static final boolean TRUE_PROJECT = false;
@@ -75,7 +75,7 @@ class Normal {
* direction to be something unusual (ie. not parallel to one of the
* coordinate axes).
*/
- S_UNIT_X = 0.50941539564955385; /* Pre-normalized */
+ S_UNIT_X = 0.50941539564955385; /* Pre-normalized */
S_UNIT_Y = 0.86052074622010633;
} else {
S_UNIT_X = 1.0;
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java
index 899df2e..474056c 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java
@@ -76,7 +76,7 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ {
freeList = 0;
this.leq = leq;
- nodes[1].handle = 1; /* so that Minimum() returns NULL */
+ nodes[1].handle = 1; /* so that Minimum() returns NULL */
handles[1].key = null;
}
@@ -171,7 +171,7 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ {
}
nodes = pqNodes;
if (nodes == null) {
- nodes = saveNodes; /* restore ptr to free upon return */
+ nodes = saveNodes; /* restore ptr to free upon return */
return Integer.MAX_VALUE;
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java
index f37f98a..f9e0225 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java
@@ -152,7 +152,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ {
} while (LT(leq, keys[order[j]], keys[piv]));
Swap(order, i, j);
} while (i < j);
- Swap(order, i, j); /* Undo last swap */
+ Swap(order, i, j); /* Undo last swap */
if (i - p < r - j) {
stack[top].p = j + 1;
stack[top].r = r;
@@ -176,7 +176,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ {
}
max = size;
initialized = true;
- heap.pqInit(); /* always succeeds */
+ heap.pqInit(); /* always succeeds */
/* #ifndef NDEBUG
p = order;
@@ -208,7 +208,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ {
System.arraycopy( keys, 0, pqKeys, 0, keys.length );
keys = pqKeys;
if (keys == null) {
- keys = saveKey; /* restore ptr to free upon return */
+ keys = saveKey; /* restore ptr to free upon return */
return Integer.MAX_VALUE;
}
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java
index 34b7ee5..1801e1c 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java
@@ -79,8 +79,8 @@ class Render {
this.render = render;
}
- long size; /* number of triangles used */
- jogamp.opengl.glu.tessellator.GLUhalfEdge eStart; /* edge where this primitive starts */
+ long size; /* number of triangles used */
+ jogamp.opengl.glu.tessellator.GLUhalfEdge eStart; /* edge where this primitive starts */
renderCallBack render;
};
@@ -295,7 +295,7 @@ class Render {
*/
jogamp.opengl.glu.tessellator.GLUhalfEdge e;
int newState;
- int edgeState = -1; /* force edge state output for first vertex */
+ int edgeState = -1; /* force edge state output for first vertex */
tess.callBeginOrBeginData(GL.GL_TRIANGLES);
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java
index 95eb5dd..b4a400c 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java
@@ -300,7 +300,7 @@ class Sweep {
regPrev = regFirst;
ePrev = regFirst.eUp;
while (regPrev != regLast) {
- regPrev.fixUpperEdge = false; /* placement was OK */
+ regPrev.fixUpperEdge = false; /* placement was OK */
reg = RegionBelow(regPrev);
e = reg.eUp;
if (e.Org != ePrev.Org) {
@@ -327,7 +327,7 @@ class Sweep {
if (!Mesh.__gl_meshSplice(e.Sym.Lnext, e)) throw new RuntimeException();
if (!Mesh.__gl_meshSplice(ePrev, e)) throw new RuntimeException();
}
- FinishRegion(tess, regPrev); /* may change reg.eUp */
+ FinishRegion(tess, regPrev); /* may change reg.eUp */
ePrev = reg.eUp;
regPrev = reg;
}
@@ -627,11 +627,11 @@ class Sweep {
assert (orgUp != tess.event && orgLo != tess.event);
assert (!regUp.fixUpperEdge && !regLo.fixUpperEdge);
- if (orgUp == orgLo) return false; /* right endpoints are the same */
+ if (orgUp == orgLo) return false; /* right endpoints are the same */
tMinUp = Math.min(orgUp.t, dstUp.t);
tMaxLo = Math.max(orgLo.t, dstLo.t);
- if (tMinUp > tMaxLo) return false; /* t ranges do not overlap */
+ if (tMinUp > tMaxLo) return false; /* t ranges do not overlap */
if (Geom.VertLeq(orgUp, orgLo)) {
if (Geom.EdgeSign(dstLo, orgUp, orgLo) > 0) return false;
@@ -743,7 +743,7 @@ class Sweep {
eUp.Org.t = isect.t;
eUp.Org.pqHandle = tess.pq.pqInsert(eUp.Org); /* __gl_pqSortInsert */
if (eUp.Org.pqHandle == Long.MAX_VALUE) {
- tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */
+ tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */
tess.pq = null;
throw new RuntimeException();
}
@@ -959,7 +959,7 @@ class Sweep {
regUp.fixUpperEdge = false;
}
if (!Mesh.__gl_meshSplice(vEvent.anEdge, e)) throw new RuntimeException();
- SweepEvent(tess, vEvent); /* recurse */
+ SweepEvent(tess, vEvent); /* recurse */
return;
}
@@ -1001,9 +1001,9 @@ class Sweep {
*
* - the degenerate case: if vEvent is close enough to U or L, we
* merge vEvent into that edge chain. The subcases are:
- * - merging with the rightmost vertex of U or L
- * - merging with the active edge of U or L
- * - merging with an already-processed portion of U or L
+ * - merging with the rightmost vertex of U or L
+ * - merging with the active edge of U or L
+ * - merging with an already-processed portion of U or L
*/ {
ActiveRegion regUp, regLo, reg;
GLUhalfEdge eUp, eLo, eNew;
@@ -1063,7 +1063,7 @@ class Sweep {
ActiveRegion regUp, reg;
GLUhalfEdge e, eTopLeft, eBottomLeft;
- tess.event = vEvent; /* for access in EdgeLeq() */
+ tess.event = vEvent; /* for access in EdgeLeq() */
DebugEvent(tess);
/* Check if this vertex is the right endpoint of an edge that is
@@ -1130,7 +1130,7 @@ class Sweep {
e.Org.t = t;
e.Sym.Org.s = -SENTINEL_COORD;
e.Sym.Org.t = t;
- tess.event = e.Sym.Org; /* initialize it */
+ tess.event = e.Sym.Org; /* initialize it */
reg.eUp = e;
reg.windingNumber = 0;
@@ -1180,7 +1180,7 @@ class Sweep {
DeleteRegion(tess, reg);
/* __gl_meshDelete( reg.eUp );*/
}
- Dict.dictDeleteDict(tess.dict); /* __gl_dictListDeleteDict */
+ Dict.dictDeleteDict(tess.dict); /* __gl_dictListDeleteDict */
}
@@ -1199,7 +1199,7 @@ class Sweep {
if (Geom.VertEq(e.Org, e.Sym.Org) && e.Lnext.Lnext != e) {
/* Zero-length edge, contour has at least 3 edges */
- SpliceMergeVertices(tess, eLnext, e); /* deletes e.Org */
+ SpliceMergeVertices(tess, eLnext, e); /* deletes e.Org */
if (!Mesh.__gl_meshDelete(e)) throw new RuntimeException(); /* e is a self-loop */
e = eLnext;
eLnext = e.Lnext;
@@ -1243,7 +1243,7 @@ class Sweep {
if (v.pqHandle == Long.MAX_VALUE) break;
}
if (v != vHead || !pq.pqInit()) { /* __gl_pqSortInit */
- tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */
+ tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */
tess.pq = null;
return false;
}
@@ -1306,7 +1306,7 @@ class Sweep {
* all the vertices in a priority queue. Events are processed in
* lexicographic order, ie.
*
- * e1 < e2 iff e1.x < e2.x || (e1.x == e2.x && e1.y < e2.y)
+ * e1 < e2 iff e1.x < e2.x || (e1.x == e2.x && e1.y < e2.y)
*/
RemoveDegenerateEdges(tess);
if (!InitPriorityQ(tess)) return false; /* if error */
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index 0858897..2a2fba8 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -49,7 +49,7 @@ import com.jogamp.gluegen.runtime.ProcAddressTable;
import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver;
public abstract class MacOSXCGLContext extends GLContextImpl
-{
+{
protected boolean isNSContext;
private CGLExt cglExt;
// Table that holds the addresses of the native C-language entry points for
@@ -178,7 +178,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
}
}
-
+
protected void releaseImpl() throws GLException {
if ( isNSContext ) {
if (!CGL.clearCurrentContext(contextHandle)) {
@@ -188,7 +188,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
CGL.CGLReleaseContext(contextHandle);
}
}
-
+
protected void destroyImpl() throws GLException {
if ( !isNSContext ) {
if (CGL.kCGLNoError != CGL.CGLDestroyContext(contextHandle)) {
@@ -254,12 +254,12 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
}
}
-
+
public String getPlatformExtensionsString()
{
return "";
}
-
+
protected void swapBuffers() {
DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable)config.getChosenCapabilities();
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java
index 6dba110..949963f 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java
@@ -48,7 +48,7 @@ public class MacOSXOffscreenCGLContext extends MacOSXPbufferCGLContext
GLContext shareWith) {
super(drawable, shareWith);
}
-
+
public int getOffscreenContextPixelDataType() {
GL gl = getGL();
return gl.isGL2GL3()?GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1;
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java
index 6eda3f0..dc5ce26 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java
@@ -138,7 +138,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable)config.getChosenCapabilities();
if (capabilities.getPbufferFloatingPointBuffers() &&
- !isTigerOrLater) {
+ !isTigerOrLater) {
throw new GLException("Floating-point pbuffers supported only on OS X 10.4 or later");
}
// Change our OpenGL mode to match that of any share context before we create ourselves
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
index 248dfa4..c9cdcad 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -169,7 +169,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
/**
* http://msdn.microsoft.com/en-us/library/ms724832%28v=vs.85%29.aspx
- * Windows XP 5.1
+ * Windows XP 5.1
*/
static final VersionNumber winXPVersionNumber = new VersionNumber ( 5, 1, 0);
@@ -199,22 +199,22 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
hasARBReadDrawable = arbReadDrawable;
vendor = glVendor;
if(null != vendor) {
- isVendorNVIDIA = vendor.startsWith("NVIDIA") ;
- isVendorATI = vendor.startsWith("ATI") ;
+ isVendorNVIDIA = vendor.startsWith("NVIDIA") ;
+ isVendorATI = vendor.startsWith("ATI") ;
}
- if ( isVendorATI() ) {
- final VersionNumber winVersion = new VersionNumber(Platform.getOSVersion(), ".");
- final boolean isWinXPOrLess = winVersion.compareTo(winXPVersionNumber) <= 0;
- if(DEBUG) {
- System.err.println("needsCurrenContext4ARBPFDQueries: "+winVersion+" <= "+winXPVersionNumber+" = "+isWinXPOrLess+" - "+Platform.getOSVersion());
- }
- needsCurrenContext4ARBPFDQueries = isWinXPOrLess;
- } else {
- if(DEBUG) {
- System.err.println("needsCurrenContext4ARBPFDQueries: false");
- }
- needsCurrenContext4ARBPFDQueries = false;
+ if ( isVendorATI() ) {
+ final VersionNumber winVersion = new VersionNumber(Platform.getOSVersion(), ".");
+ final boolean isWinXPOrLess = winVersion.compareTo(winXPVersionNumber) <= 0;
+ if(DEBUG) {
+ System.err.println("needsCurrenContext4ARBPFDQueries: "+winVersion+" <= "+winXPVersionNumber+" = "+isWinXPOrLess+" - "+Platform.getOSVersion());
+ }
+ needsCurrenContext4ARBPFDQueries = isWinXPOrLess;
+ } else {
+ if(DEBUG) {
+ System.err.println("needsCurrenContext4ARBPFDQueries: false");
+ }
+ needsCurrenContext4ARBPFDQueries = false;
}
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
index 1899f52..8859d63 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
@@ -158,7 +158,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
if (0 == hdc) {
throw new GLException("Error: HDC is null");
}
-
+
if (!GDI.SetPixelFormat(hdc, caps.getPFDID(), caps.getPFD())) {
throw new GLException("Unable to set pixel format " + caps +
" for device context " + toHexString(hdc) +
@@ -166,7 +166,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
}
if (DEBUG) {
System.err.println("!!! setPixelFormat (ARB): hdc "+toHexString(hdc) +", "+caps);
- }
+ }
setCapsPFD(caps);
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
index 8c1f5e8..d765572 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
@@ -192,25 +192,25 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) ns.getGraphicsConfiguration().getNativeGraphicsConfiguration();
if( !config.isExternal() ) {
- if( !config.isDetermined() ) {
- updateGraphicsConfiguration(config, chooser, factory, hdc, false, pfdIDs);
- } else {
- // set PFD if not set yet
- int pfdID = -1;
- boolean set = false;
- if ( 1 > ( pfdID = GDI.GetPixelFormat(hdc) ) ) {
- if (!GDI.SetPixelFormat(hdc, config.getPixelFormatID(), config.getPixelFormat())) {
- throw new GLException("Unable to set pixel format " + config.getPixelFormatID() +
- " for device context " + toHexString(hdc) +
- ": error code " + GDI.GetLastError());
- }
- set = true;
- }
- if (DEBUG) {
- System.err.println("!!! setPixelFormat (post): hdc "+toHexString(hdc) +", "+pfdID+" -> "+config.getPixelFormatID()+", set: "+set);
- Thread.dumpStack();
- }
- }
+ if( !config.isDetermined() ) {
+ updateGraphicsConfiguration(config, chooser, factory, hdc, false, pfdIDs);
+ } else {
+ // set PFD if not set yet
+ int pfdID = -1;
+ boolean set = false;
+ if ( 1 > ( pfdID = GDI.GetPixelFormat(hdc) ) ) {
+ if (!GDI.SetPixelFormat(hdc, config.getPixelFormatID(), config.getPixelFormat())) {
+ throw new GLException("Unable to set pixel format " + config.getPixelFormatID() +
+ " for device context " + toHexString(hdc) +
+ ": error code " + GDI.GetLastError());
+ }
+ set = true;
+ }
+ if (DEBUG) {
+ System.err.println("!!! setPixelFormat (post): hdc "+toHexString(hdc) +", "+pfdID+" -> "+config.getPixelFormatID()+", set: "+set);
+ Thread.dumpStack();
+ }
+ }
}
} finally {
ns.unlockSurface();
@@ -400,9 +400,9 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
}
if ( !extHDC && !pixelFormatSet ) {
- config.setPixelFormat(hdc, pixelFormatCaps);
+ config.setPixelFormat(hdc, pixelFormatCaps);
} else {
- config.setCapsPFD(pixelFormatCaps);
+ config.setCapsPFD(pixelFormatCaps);
}
return true;
}
@@ -476,9 +476,9 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
}
if ( !extHDC && !pixelFormatSet ) {
- config.setPixelFormat(hdc, pixelFormatCaps);
+ config.setPixelFormat(hdc, pixelFormatCaps);
} else {
- config.setCapsPFD(pixelFormatCaps);
+ config.setCapsPFD(pixelFormatCaps);
}
return true;
}
diff --git a/src/jogl/native/macosx/ContextUpdater.h b/src/jogl/native/macosx/ContextUpdater.h
index e8b757f..f8ce93d 100644
--- a/src/jogl/native/macosx/ContextUpdater.h
+++ b/src/jogl/native/macosx/ContextUpdater.h
@@ -15,11 +15,11 @@ This notification is sent whenever an NSView that has an attached NSSurface chan
//#define DEBUG_GL_LOCKS
#ifdef DEBUG_GL_LOCKS
- #define LOCK_GL(func, line) [ContextUpdater lockInFunction:func atLine:line];
- #define UNLOCK_GL(func, line) [ContextUpdater unlockInFunction:func atLine:line];
+ #define LOCK_GL(func, line) [ContextUpdater lockInFunction:func atLine:line];
+ #define UNLOCK_GL(func, line) [ContextUpdater unlockInFunction:func atLine:line];
#else
- #define LOCK_GL(func, line) [ContextUpdater lock];
- #define UNLOCK_GL(func, line) [ContextUpdater unlock];
+ #define LOCK_GL(func, line) [ContextUpdater lock];
+ #define UNLOCK_GL(func, line) [ContextUpdater unlock];
#endif
// gznote: OpenGL NOT thread safe - need to sync on update and paints
diff --git a/src/jogl/native/macosx/ContextUpdater.m b/src/jogl/native/macosx/ContextUpdater.m
index 587782c..8596977 100644
--- a/src/jogl/native/macosx/ContextUpdater.m
+++ b/src/jogl/native/macosx/ContextUpdater.m
@@ -10,74 +10,74 @@ static pthread_mutex_t resourceLock = PTHREAD_MUTEX_INITIALIZER;
static void printLockDebugInfo(char *message, char *func, int line)
{
- fprintf(stderr, "%s in function: \"%s\" at line: %d\n", message, func, line);
- fflush(stderr);
+ fprintf(stderr, "%s in function: \"%s\" at line: %d\n", message, func, line);
+ fflush(stderr);
}
+ (void) lock
{
- if (theContext != NULL)
- {
- pthread_mutex_lock(&resourceLock);
- }
+ if (theContext != NULL)
+ {
+ pthread_mutex_lock(&resourceLock);
+ }
}
+ (void) lockInFunction:(char *)func atLine:(int)line
{
- if (theContext != NULL)
- {
- printLockDebugInfo("locked ", func, line);
- [self lock];
- }
+ if (theContext != NULL)
+ {
+ printLockDebugInfo("locked ", func, line);
+ [self lock];
+ }
}
+ (void) unlock
{
- if (theContext != NULL)
- {
- pthread_mutex_unlock(&resourceLock);
- }
+ if (theContext != NULL)
+ {
+ pthread_mutex_unlock(&resourceLock);
+ }
}
+ (void) unlockInFunction:(char *)func atLine:(int)line
{
- if (theContext != NULL)
- {
- printLockDebugInfo("unlocked", func, line);
- [self unlock];
- }
+ if (theContext != NULL)
+ {
+ printLockDebugInfo("unlocked", func, line);
+ [self unlock];
+ }
}
- (void) registerFor:(NSOpenGLContext *)context with: (NSView *)view
{
- if (view != NULL)
- {
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(update:) name:NSViewGlobalFrameDidChangeNotification object: view];
- theContext = context;
- }
+ if (view != NULL)
+ {
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(update:) name:NSViewGlobalFrameDidChangeNotification object: view];
+ theContext = context;
+ }
}
- (void) update:(NSNotification *)notification
{
- [ContextUpdater lock];
-
- [theContext update];
-
- [ContextUpdater unlock];
+ [ContextUpdater lock];
+
+ [theContext update];
+
+ [ContextUpdater unlock];
}
- (id) init
-{
- theContext = NULL;
-
- return [super init];
+{
+ theContext = NULL;
+
+ return [super init];
}
- (void) dealloc
{
- [[NSNotificationCenter defaultCenter] removeObserver:self];
-
- [super dealloc];
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+
+ [super dealloc];
}
@end \ No newline at end of file
diff --git a/src/jogl/native/macosx/MacOSXWindowSystemInterface.m b/src/jogl/native/macosx/MacOSXWindowSystemInterface.m
index cbfea6d..9a7356b 100644
--- a/src/jogl/native/macosx/MacOSXWindowSystemInterface.m
+++ b/src/jogl/native/macosx/MacOSXWindowSystemInterface.m
@@ -5,7 +5,7 @@
#include <AvailabilityMacros.h>
#ifndef MAC_OS_X_VERSION_10_3
- #error building JOGL requires Mac OS X 10.3 or greater
+ #error building JOGL requires Mac OS X 10.3 or greater
#endif
#ifndef MAC_OS_X_VERSION_10_4
@@ -44,45 +44,45 @@
struct _RendererInfo
{
- long id; // kCGLRPRendererID
- long displayMask; // kCGLRPDisplayMask
-
- long accelerated; // kCGLRPAccelerated
-
- long window; // kCGLRPWindow
- long fullscreen; // kCGLRPFullScreen
- long multiscreen; // kCGLRPMultiScreen
- long offscreen; // kCGLRPOffScreen
- long floatPixels; // see kCGLRPColorModes
- long stereo; // kCGLRPBufferModes
-
- long auxBuffers; // kCGLRPMaxAuxBuffers
- long sampleBuffers; // kCGLRPMaxSampleBuffers
- long samples; // kCGLRPMaxSamples
- long samplesModes; // kCGLRPSampleModes
- long multiSample; // see kCGLRPSampleModes
- long superSample; // see kCGLRPSampleModes
- long alphaSample; // kCGLRPSampleAlpha
-
- long colorModes; // kCGLRPColorModes
- long colorRGBSizeMAX;
- long colorASizeMAX;
- long colorFloatRGBSizeMAX;
- long colorFloatASizeMAX;
- long colorFloatRGBSizeMIN;
- long colorFloatASizeMIN;
- long colorModesCount;
- long colorFloatModesCount;
- long depthModes; // kCGLRPDepthModes
- long depthSizeMAX;
- long depthModesCount;
- long stencilModes; // kCGLRPStencilModes
- long stencilSizeMAX;
- long stencilModesCount;
- long accumModes; // kCGLRPAccumModes
- long accumRGBSizeMAX;
- long accumASizeMAX;
- long accumModesCount;
+ long id; // kCGLRPRendererID
+ long displayMask; // kCGLRPDisplayMask
+
+ long accelerated; // kCGLRPAccelerated
+
+ long window; // kCGLRPWindow
+ long fullscreen; // kCGLRPFullScreen
+ long multiscreen; // kCGLRPMultiScreen
+ long offscreen; // kCGLRPOffScreen
+ long floatPixels; // see kCGLRPColorModes
+ long stereo; // kCGLRPBufferModes
+
+ long auxBuffers; // kCGLRPMaxAuxBuffers
+ long sampleBuffers; // kCGLRPMaxSampleBuffers
+ long samples; // kCGLRPMaxSamples
+ long samplesModes; // kCGLRPSampleModes
+ long multiSample; // see kCGLRPSampleModes
+ long superSample; // see kCGLRPSampleModes
+ long alphaSample; // kCGLRPSampleAlpha
+
+ long colorModes; // kCGLRPColorModes
+ long colorRGBSizeMAX;
+ long colorASizeMAX;
+ long colorFloatRGBSizeMAX;
+ long colorFloatASizeMAX;
+ long colorFloatRGBSizeMIN;
+ long colorFloatASizeMIN;
+ long colorModesCount;
+ long colorFloatModesCount;
+ long depthModes; // kCGLRPDepthModes
+ long depthSizeMAX;
+ long depthModesCount;
+ long stencilModes; // kCGLRPStencilModes
+ long stencilSizeMAX;
+ long stencilModesCount;
+ long accumModes; // kCGLRPAccumModes
+ long accumRGBSizeMAX;
+ long accumASizeMAX;
+ long accumModesCount;
}
typedef RendererInfo;
@@ -90,263 +90,263 @@ RendererInfo *gRenderers = NULL;
long gRenderersCount = 0;
long depthModes[] = {
- kCGL0Bit,
- kCGL1Bit,
- kCGL2Bit,
- kCGL3Bit,
- kCGL4Bit,
- kCGL5Bit,
- kCGL6Bit,
- kCGL8Bit,
- kCGL10Bit,
- kCGL12Bit,
- kCGL16Bit,
- kCGL24Bit,
- kCGL32Bit,
- kCGL48Bit,
- kCGL64Bit,
- kCGL96Bit,
- kCGL128Bit,
- 0
- };
+ kCGL0Bit,
+ kCGL1Bit,
+ kCGL2Bit,
+ kCGL3Bit,
+ kCGL4Bit,
+ kCGL5Bit,
+ kCGL6Bit,
+ kCGL8Bit,
+ kCGL10Bit,
+ kCGL12Bit,
+ kCGL16Bit,
+ kCGL24Bit,
+ kCGL32Bit,
+ kCGL48Bit,
+ kCGL64Bit,
+ kCGL96Bit,
+ kCGL128Bit,
+ 0
+ };
long depthModesBits[] = {0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 24, 32, 48, 64, 96, 128};
long colorModes[] = {
- kCGLRGB444Bit,
- kCGLARGB4444Bit,
- kCGLRGB444A8Bit,
- kCGLRGB555Bit,
- kCGLARGB1555Bit,
- kCGLRGB555A8Bit,
- kCGLRGB565Bit,
- kCGLRGB565A8Bit,
- kCGLRGB888Bit,
- kCGLARGB8888Bit,
- kCGLRGB888A8Bit,
- kCGLRGB101010Bit,
- kCGLARGB2101010Bit,
- kCGLRGB101010_A8Bit,
- kCGLRGB121212Bit,
- kCGLARGB12121212Bit,
- kCGLRGB161616Bit,
- kCGLRGBA16161616Bit,
- kCGLRGBFloat64Bit,
- kCGLRGBAFloat64Bit,
- kCGLRGBFloat128Bit,
- kCGLRGBAFloat128Bit,
- kCGLRGBFloat256Bit,
- kCGLRGBAFloat256Bit,
- 0
- };
-long colorModesBitsRGB[] = {4, 4, 4, 5, 5, 5, 5, 5, 8, 8, 8, 10, 10, 10, 12, 12, 16, 16, 16, 16, 32, 32, 64, 64};
-long colorModesBitsA[] = {0, 4, 8, 0, 1, 8, 0, 8, 0, 8, 8, 0, 2, 8, 0, 12, 0, 16, 0, 16, 0, 32, 0, 64};
+ kCGLRGB444Bit,
+ kCGLARGB4444Bit,
+ kCGLRGB444A8Bit,
+ kCGLRGB555Bit,
+ kCGLARGB1555Bit,
+ kCGLRGB555A8Bit,
+ kCGLRGB565Bit,
+ kCGLRGB565A8Bit,
+ kCGLRGB888Bit,
+ kCGLARGB8888Bit,
+ kCGLRGB888A8Bit,
+ kCGLRGB101010Bit,
+ kCGLARGB2101010Bit,
+ kCGLRGB101010_A8Bit,
+ kCGLRGB121212Bit,
+ kCGLARGB12121212Bit,
+ kCGLRGB161616Bit,
+ kCGLRGBA16161616Bit,
+ kCGLRGBFloat64Bit,
+ kCGLRGBAFloat64Bit,
+ kCGLRGBFloat128Bit,
+ kCGLRGBAFloat128Bit,
+ kCGLRGBFloat256Bit,
+ kCGLRGBAFloat256Bit,
+ 0
+ };
+long colorModesBitsRGB[] = {4, 4, 4, 5, 5, 5, 5, 5, 8, 8, 8, 10, 10, 10, 12, 12, 16, 16, 16, 16, 32, 32, 64, 64};
+long colorModesBitsA[] = {0, 4, 8, 0, 1, 8, 0, 8, 0, 8, 8, 0, 2, 8, 0, 12, 0, 16, 0, 16, 0, 32, 0, 64};
void getRendererInfo()
{
- if (gRenderersCount == 0)
- {
- CGLRendererInfoObj info;
- CGLError err = CGLQueryRendererInfo(CGDisplayIDToOpenGLDisplayMask(kCGDirectMainDisplay), &info, &gRenderersCount);
- if (err == 0 /* kCGLNoError */)
- {
- // how many renderers are available?
- CGLDescribeRenderer(info, 0, kCGLRPRendererCount, &gRenderersCount);
-
- // allocate our global renderers info
- gRenderers = (RendererInfo*)malloc(gRenderersCount*sizeof(RendererInfo));
- memset(gRenderers, 0x00, gRenderersCount*sizeof(RendererInfo));
-
- // iterate through the renderers checking for their features
- long j;
- for (j=0; j<gRenderersCount; j++)
- {
- RendererInfo *renderer = &gRenderers[j];
- int i;
-
- CGLDescribeRenderer(info, j, kCGLRPRendererID, &(renderer->id));
- CGLDescribeRenderer(info, j, kCGLRPDisplayMask, &(renderer->displayMask));
-
- CGLDescribeRenderer(info, j, kCGLRPAccelerated, &(renderer->accelerated));
-
- CGLDescribeRenderer(info, j, kCGLRPWindow, &(renderer->window));
- CGLDescribeRenderer(info, j, kCGLRPFullScreen, &(renderer->fullscreen));
- CGLDescribeRenderer(info, j, kCGLRPMultiScreen, &(renderer->multiscreen));
- CGLDescribeRenderer(info, j, kCGLRPOffScreen, &(renderer->offscreen));
- CGLDescribeRenderer(info, j, kCGLRPColorModes, &(renderer->floatPixels));
- if ((renderer->floatPixels >= kCGLRGBFloat64Bit) != 0)
- {
- renderer->floatPixels = 1;
- }
- else
- {
- renderer->floatPixels = 0;
- }
- CGLDescribeRenderer(info, j, kCGLRPBufferModes, &(renderer->stereo));
- if ((renderer->stereo & kCGLStereoscopicBit) != 0)
- {
- renderer->stereo = 1;
- }
- else
- {
- renderer->stereo = 0;
- }
-
- CGLDescribeRenderer(info, j, kCGLRPMaxAuxBuffers, &(renderer->auxBuffers));
- CGLDescribeRenderer(info, j, kCGLRPMaxSampleBuffers, &(renderer->sampleBuffers));
- CGLDescribeRenderer(info, j, kCGLRPMaxSamples, &(renderer->samples));
- // The following queries are only legal on 10.4
- // FIXME: should figure out a way to enable them dynamically
+ if (gRenderersCount == 0)
+ {
+ CGLRendererInfoObj info;
+ CGLError err = CGLQueryRendererInfo(CGDisplayIDToOpenGLDisplayMask(kCGDirectMainDisplay), &info, &gRenderersCount);
+ if (err == 0 /* kCGLNoError */)
+ {
+ // how many renderers are available?
+ CGLDescribeRenderer(info, 0, kCGLRPRendererCount, &gRenderersCount);
+
+ // allocate our global renderers info
+ gRenderers = (RendererInfo*)malloc(gRenderersCount*sizeof(RendererInfo));
+ memset(gRenderers, 0x00, gRenderersCount*sizeof(RendererInfo));
+
+ // iterate through the renderers checking for their features
+ long j;
+ for (j=0; j<gRenderersCount; j++)
+ {
+ RendererInfo *renderer = &gRenderers[j];
+ int i;
+
+ CGLDescribeRenderer(info, j, kCGLRPRendererID, &(renderer->id));
+ CGLDescribeRenderer(info, j, kCGLRPDisplayMask, &(renderer->displayMask));
+
+ CGLDescribeRenderer(info, j, kCGLRPAccelerated, &(renderer->accelerated));
+
+ CGLDescribeRenderer(info, j, kCGLRPWindow, &(renderer->window));
+ CGLDescribeRenderer(info, j, kCGLRPFullScreen, &(renderer->fullscreen));
+ CGLDescribeRenderer(info, j, kCGLRPMultiScreen, &(renderer->multiscreen));
+ CGLDescribeRenderer(info, j, kCGLRPOffScreen, &(renderer->offscreen));
+ CGLDescribeRenderer(info, j, kCGLRPColorModes, &(renderer->floatPixels));
+ if ((renderer->floatPixels >= kCGLRGBFloat64Bit) != 0)
+ {
+ renderer->floatPixels = 1;
+ }
+ else
+ {
+ renderer->floatPixels = 0;
+ }
+ CGLDescribeRenderer(info, j, kCGLRPBufferModes, &(renderer->stereo));
+ if ((renderer->stereo & kCGLStereoscopicBit) != 0)
+ {
+ renderer->stereo = 1;
+ }
+ else
+ {
+ renderer->stereo = 0;
+ }
+
+ CGLDescribeRenderer(info, j, kCGLRPMaxAuxBuffers, &(renderer->auxBuffers));
+ CGLDescribeRenderer(info, j, kCGLRPMaxSampleBuffers, &(renderer->sampleBuffers));
+ CGLDescribeRenderer(info, j, kCGLRPMaxSamples, &(renderer->samples));
+ // The following queries are only legal on 10.4
+ // FIXME: should figure out a way to enable them dynamically
#ifdef kCGLRPSampleModes
- CGLDescribeRenderer(info, j, kCGLRPSampleModes, &(renderer->samplesModes));
- if ((renderer->samplesModes & kCGLSupersampleBit) != 0)
- {
- renderer->multiSample = 1;
- }
- if ((renderer->samplesModes & kCGLMultisampleBit) != 0)
- {
- renderer->superSample = 1;
- }
- CGLDescribeRenderer(info, j, kCGLRPSampleAlpha, &(renderer->alphaSample));
+ CGLDescribeRenderer(info, j, kCGLRPSampleModes, &(renderer->samplesModes));
+ if ((renderer->samplesModes & kCGLSupersampleBit) != 0)
+ {
+ renderer->multiSample = 1;
+ }
+ if ((renderer->samplesModes & kCGLMultisampleBit) != 0)
+ {
+ renderer->superSample = 1;
+ }
+ CGLDescribeRenderer(info, j, kCGLRPSampleAlpha, &(renderer->alphaSample));
#endif
- CGLDescribeRenderer(info, j, kCGLRPColorModes, &(renderer->colorModes));
- i=0;
- int floatPixelFormatInitialized = 0;
- while (colorModes[i] != 0)
- {
- if ((renderer->colorModes & colorModes[i]) != 0)
- {
- // non-float color model
- if (colorModes[i] < kCGLRGBFloat64Bit)
- {
- // look for max color and alpha values - prefer color models that have alpha
- if ((colorModesBitsRGB[i] >= renderer->colorRGBSizeMAX) && (colorModesBitsA[i] >= renderer->colorASizeMAX))
- {
- renderer->colorRGBSizeMAX = colorModesBitsRGB[i];
- renderer->colorASizeMAX = colorModesBitsA[i];
- }
- renderer->colorModesCount++;
- }
- // float-color model
- if (colorModes[i] >= kCGLRGBFloat64Bit)
- {
- if (floatPixelFormatInitialized == 0)
- {
- floatPixelFormatInitialized = 1;
-
- renderer->colorFloatASizeMAX = colorModesBitsA[i];
- renderer->colorFloatRGBSizeMAX = colorModesBitsRGB[i];
- renderer->colorFloatASizeMIN = colorModesBitsA[i];
- renderer->colorFloatRGBSizeMIN = colorModesBitsRGB[i];
- }
- // look for max color and alpha values - prefer color models that have alpha
- if ((colorModesBitsRGB[i] >= renderer->colorFloatRGBSizeMAX) && (colorModesBitsA[i] >= renderer->colorFloatASizeMAX))
- {
- renderer->colorFloatRGBSizeMAX = colorModesBitsRGB[i];
- renderer->colorFloatASizeMAX = colorModesBitsA[i];
- }
- // find min color
- if (colorModesBitsA[i] < renderer->colorFloatASizeMIN)
- {
- renderer->colorFloatASizeMIN = colorModesBitsA[i];
- }
- // find min alpha color
- if (colorModesBitsA[i] < renderer->colorFloatRGBSizeMIN)
- {
- renderer->colorFloatRGBSizeMIN = colorModesBitsRGB[i];
- }
- renderer->colorFloatModesCount++;
- }
- }
- i++;
- }
- CGLDescribeRenderer(info, j, kCGLRPDepthModes, &(renderer->depthModes));
- i=0;
- while (depthModes[i] != 0)
- {
- if ((renderer->depthModes & depthModes[i]) != 0)
- {
- renderer->depthSizeMAX = depthModesBits[i];
- renderer->depthModesCount++;
- }
- i++;
- }
- CGLDescribeRenderer(info, j, kCGLRPStencilModes, &(renderer->stencilModes));
- i=0;
- while (depthModes[i] != 0)
- {
- if ((renderer->stencilModes & depthModes[i]) != 0)
- {
- renderer->stencilSizeMAX = depthModesBits[i];
- renderer->stencilModesCount++;
- }
- i++;
- }
- CGLDescribeRenderer(info, j, kCGLRPAccumModes, &(renderer->accumModes));
- i=0;
- while (colorModes[i] != 0)
- {
- if ((renderer->accumModes & colorModes[i]) != 0)
- {
- if ((colorModesBitsRGB[i] >= renderer->accumRGBSizeMAX) && (colorModesBitsA[i] >= renderer->accumASizeMAX))
- {
- renderer->accumRGBSizeMAX = colorModesBitsRGB[i];
- renderer->accumASizeMAX = colorModesBitsA[i];
- }
- renderer->accumModesCount++;
- }
- i++;
- }
- }
- }
- CGLDestroyRendererInfo (info);
- }
-
+ CGLDescribeRenderer(info, j, kCGLRPColorModes, &(renderer->colorModes));
+ i=0;
+ int floatPixelFormatInitialized = 0;
+ while (colorModes[i] != 0)
+ {
+ if ((renderer->colorModes & colorModes[i]) != 0)
+ {
+ // non-float color model
+ if (colorModes[i] < kCGLRGBFloat64Bit)
+ {
+ // look for max color and alpha values - prefer color models that have alpha
+ if ((colorModesBitsRGB[i] >= renderer->colorRGBSizeMAX) && (colorModesBitsA[i] >= renderer->colorASizeMAX))
+ {
+ renderer->colorRGBSizeMAX = colorModesBitsRGB[i];
+ renderer->colorASizeMAX = colorModesBitsA[i];
+ }
+ renderer->colorModesCount++;
+ }
+ // float-color model
+ if (colorModes[i] >= kCGLRGBFloat64Bit)
+ {
+ if (floatPixelFormatInitialized == 0)
+ {
+ floatPixelFormatInitialized = 1;
+
+ renderer->colorFloatASizeMAX = colorModesBitsA[i];
+ renderer->colorFloatRGBSizeMAX = colorModesBitsRGB[i];
+ renderer->colorFloatASizeMIN = colorModesBitsA[i];
+ renderer->colorFloatRGBSizeMIN = colorModesBitsRGB[i];
+ }
+ // look for max color and alpha values - prefer color models that have alpha
+ if ((colorModesBitsRGB[i] >= renderer->colorFloatRGBSizeMAX) && (colorModesBitsA[i] >= renderer->colorFloatASizeMAX))
+ {
+ renderer->colorFloatRGBSizeMAX = colorModesBitsRGB[i];
+ renderer->colorFloatASizeMAX = colorModesBitsA[i];
+ }
+ // find min color
+ if (colorModesBitsA[i] < renderer->colorFloatASizeMIN)
+ {
+ renderer->colorFloatASizeMIN = colorModesBitsA[i];
+ }
+ // find min alpha color
+ if (colorModesBitsA[i] < renderer->colorFloatRGBSizeMIN)
+ {
+ renderer->colorFloatRGBSizeMIN = colorModesBitsRGB[i];
+ }
+ renderer->colorFloatModesCount++;
+ }
+ }
+ i++;
+ }
+ CGLDescribeRenderer(info, j, kCGLRPDepthModes, &(renderer->depthModes));
+ i=0;
+ while (depthModes[i] != 0)
+ {
+ if ((renderer->depthModes & depthModes[i]) != 0)
+ {
+ renderer->depthSizeMAX = depthModesBits[i];
+ renderer->depthModesCount++;
+ }
+ i++;
+ }
+ CGLDescribeRenderer(info, j, kCGLRPStencilModes, &(renderer->stencilModes));
+ i=0;
+ while (depthModes[i] != 0)
+ {
+ if ((renderer->stencilModes & depthModes[i]) != 0)
+ {
+ renderer->stencilSizeMAX = depthModesBits[i];
+ renderer->stencilModesCount++;
+ }
+ i++;
+ }
+ CGLDescribeRenderer(info, j, kCGLRPAccumModes, &(renderer->accumModes));
+ i=0;
+ while (colorModes[i] != 0)
+ {
+ if ((renderer->accumModes & colorModes[i]) != 0)
+ {
+ if ((colorModesBitsRGB[i] >= renderer->accumRGBSizeMAX) && (colorModesBitsA[i] >= renderer->accumASizeMAX))
+ {
+ renderer->accumRGBSizeMAX = colorModesBitsRGB[i];
+ renderer->accumASizeMAX = colorModesBitsA[i];
+ }
+ renderer->accumModesCount++;
+ }
+ i++;
+ }
+ }
+ }
+ CGLDestroyRendererInfo (info);
+ }
+
#if 0
- fprintf(stderr, "gRenderersCount=%ld\n", gRenderersCount);
- int j;
- for (j=0; j<gRenderersCount; j++)
- {
- RendererInfo *renderer = &gRenderers[j];
- fprintf(stderr, " id=%ld\n", renderer->id);
- fprintf(stderr, " displayMask=%ld\n", renderer->displayMask);
-
- fprintf(stderr, " accelerated=%ld\n", renderer->accelerated);
-
- fprintf(stderr, " window=%ld\n", renderer->window);
- fprintf(stderr, " fullscreen=%ld\n", renderer->fullscreen);
- fprintf(stderr, " multiscreen=%ld\n", renderer->multiscreen);
- fprintf(stderr, " offscreen=%ld\n", renderer->offscreen);
- fprintf(stderr, " floatPixels=%ld\n", renderer->floatPixels);
- fprintf(stderr, " stereo=%ld\n", renderer->stereo);
-
- fprintf(stderr, " auxBuffers=%ld\n", renderer->auxBuffers);
- fprintf(stderr, " sampleBuffers=%ld\n", renderer->sampleBuffers);
- fprintf(stderr, " samples=%ld\n", renderer->samples);
- fprintf(stderr, " samplesModes=%ld\n", renderer->samplesModes);
- fprintf(stderr, " multiSample=%ld\n", renderer->superSample);
- fprintf(stderr, " superSample=%ld\n", renderer->superSample);
- fprintf(stderr, " alphaSample=%ld\n", renderer->alphaSample);
-
- fprintf(stderr, " colorModes=%ld\n", renderer->colorModes);
- fprintf(stderr, " colorRGBSizeMAX=%ld\n", renderer->colorRGBSizeMAX);
- fprintf(stderr, " colorASizeMAX=%ld\n", renderer->colorASizeMAX);
- fprintf(stderr, " colorFloatRGBSizeMAX=%ld\n", renderer->colorFloatRGBSizeMAX);
- fprintf(stderr, " colorFloatASizeMAX=%ld\n", renderer->colorFloatASizeMAX);
- fprintf(stderr, " colorFloatRGBSizeMIN=%ld\n", renderer->colorFloatRGBSizeMIN);
- fprintf(stderr, " colorFloatASizeMIN=%ld\n", renderer->colorFloatASizeMIN);
- fprintf(stderr, " colorModesCount=%ld\n", renderer->colorModesCount);
- fprintf(stderr, " colorFloatModesCount=%ld\n", renderer->colorFloatModesCount);
- fprintf(stderr, " depthModes=%ld\n", renderer->depthModes);
- fprintf(stderr, " depthSizeMAX=%ld\n", renderer->depthSizeMAX);
- fprintf(stderr, " depthModesCount=%ld\n", renderer->depthModesCount);
- fprintf(stderr, " stencilModes=%ld\n", renderer->stencilModes);
- fprintf(stderr, " stencilSizeMAX=%ld\n", renderer->stencilSizeMAX);
- fprintf(stderr, " stencilModesCount=%ld\n", renderer->stencilModesCount);
- fprintf(stderr, " accumModes=%ld\n", renderer->accumModes);
- fprintf(stderr, " accumRGBSizeMAX=%ld\n", renderer->accumRGBSizeMAX);
- fprintf(stderr, " accumASizeMAX=%ld\n", renderer->accumASizeMAX);
- fprintf(stderr, " accumModesCount=%ld\n", renderer->accumModesCount);
- fprintf(stderr, "\n");
- }
+ fprintf(stderr, "gRenderersCount=%ld\n", gRenderersCount);
+ int j;
+ for (j=0; j<gRenderersCount; j++)
+ {
+ RendererInfo *renderer = &gRenderers[j];
+ fprintf(stderr, " id=%ld\n", renderer->id);
+ fprintf(stderr, " displayMask=%ld\n", renderer->displayMask);
+
+ fprintf(stderr, " accelerated=%ld\n", renderer->accelerated);
+
+ fprintf(stderr, " window=%ld\n", renderer->window);
+ fprintf(stderr, " fullscreen=%ld\n", renderer->fullscreen);
+ fprintf(stderr, " multiscreen=%ld\n", renderer->multiscreen);
+ fprintf(stderr, " offscreen=%ld\n", renderer->offscreen);
+ fprintf(stderr, " floatPixels=%ld\n", renderer->floatPixels);
+ fprintf(stderr, " stereo=%ld\n", renderer->stereo);
+
+ fprintf(stderr, " auxBuffers=%ld\n", renderer->auxBuffers);
+ fprintf(stderr, " sampleBuffers=%ld\n", renderer->sampleBuffers);
+ fprintf(stderr, " samples=%ld\n", renderer->samples);
+ fprintf(stderr, " samplesModes=%ld\n", renderer->samplesModes);
+ fprintf(stderr, " multiSample=%ld\n", renderer->superSample);
+ fprintf(stderr, " superSample=%ld\n", renderer->superSample);
+ fprintf(stderr, " alphaSample=%ld\n", renderer->alphaSample);
+
+ fprintf(stderr, " colorModes=%ld\n", renderer->colorModes);
+ fprintf(stderr, " colorRGBSizeMAX=%ld\n", renderer->colorRGBSizeMAX);
+ fprintf(stderr, " colorASizeMAX=%ld\n", renderer->colorASizeMAX);
+ fprintf(stderr, " colorFloatRGBSizeMAX=%ld\n", renderer->colorFloatRGBSizeMAX);
+ fprintf(stderr, " colorFloatASizeMAX=%ld\n", renderer->colorFloatASizeMAX);
+ fprintf(stderr, " colorFloatRGBSizeMIN=%ld\n", renderer->colorFloatRGBSizeMIN);
+ fprintf(stderr, " colorFloatASizeMIN=%ld\n", renderer->colorFloatASizeMIN);
+ fprintf(stderr, " colorModesCount=%ld\n", renderer->colorModesCount);
+ fprintf(stderr, " colorFloatModesCount=%ld\n", renderer->colorFloatModesCount);
+ fprintf(stderr, " depthModes=%ld\n", renderer->depthModes);
+ fprintf(stderr, " depthSizeMAX=%ld\n", renderer->depthSizeMAX);
+ fprintf(stderr, " depthModesCount=%ld\n", renderer->depthModesCount);
+ fprintf(stderr, " stencilModes=%ld\n", renderer->stencilModes);
+ fprintf(stderr, " stencilSizeMAX=%ld\n", renderer->stencilSizeMAX);
+ fprintf(stderr, " stencilModesCount=%ld\n", renderer->stencilModesCount);
+ fprintf(stderr, " accumModes=%ld\n", renderer->accumModes);
+ fprintf(stderr, " accumRGBSizeMAX=%ld\n", renderer->accumRGBSizeMAX);
+ fprintf(stderr, " accumASizeMAX=%ld\n", renderer->accumASizeMAX);
+ fprintf(stderr, " accumModesCount=%ld\n", renderer->accumModesCount);
+ fprintf(stderr, "\n");
+ }
#endif
}
@@ -368,7 +368,7 @@ long validateParameter(NSOpenGLPixelFormatAttribute attribute, long value)
}
}
}
-
+
return value;
}
@@ -472,66 +472,66 @@ void* createContext(void* shareContext,
void* pixelFormat,
int* viewNotReady)
{
- getRendererInfo();
-
- NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ getRendererInfo();
+
+ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
- NSView *nsView = NULL;
+ NSView *nsView = NULL;
NSObject *nsObj = (NSObject*) view;
if( nsObj != NULL && [nsObj isKindOfClass:[NSView class]] ) {
nsView = (NSView*)nsObj;
}
- if (nsView != NULL)
- {
- Bool viewReady = true;
-
- if ([nsView lockFocusIfCanDraw] == NO)
- {
- viewReady = false;
- }
- else
- {
- NSRect frame = [nsView frame];
- if ((frame.size.width == 0) || (frame.size.height == 0))
- {
- [nsView unlockFocus];
- viewReady = false;
- }
- }
-
- if (!viewReady)
- {
- if (viewNotReady != NULL)
- {
- *viewNotReady = 1;
- }
-
- // the view is not ready yet
- [pool release];
- return NULL;
- }
- }
-
- NSOpenGLContext* nsContext = [[NSOpenGLContext alloc]
+ if (nsView != NULL)
+ {
+ Bool viewReady = true;
+
+ if ([nsView lockFocusIfCanDraw] == NO)
+ {
+ viewReady = false;
+ }
+ else
+ {
+ NSRect frame = [nsView frame];
+ if ((frame.size.width == 0) || (frame.size.height == 0))
+ {
+ [nsView unlockFocus];
+ viewReady = false;
+ }
+ }
+
+ if (!viewReady)
+ {
+ if (viewNotReady != NULL)
+ {
+ *viewNotReady = 1;
+ }
+
+ // the view is not ready yet
+ [pool release];
+ return NULL;
+ }
+ }
+
+ NSOpenGLContext* nsContext = [[NSOpenGLContext alloc]
initWithFormat: (NSOpenGLPixelFormat*) pixelFormat
shareContext: (NSOpenGLContext*) shareContext];
-
+
if (nsContext != nil) {
if (nsView != nil) {
[nsContext setView:nsView];
- [nsView unlockFocus];
+ [nsView unlockFocus];
}
}
- [pool release];
- return nsContext;
+ [pool release];
+ return nsContext;
}
void * getCurrentContext() {
NSOpenGLContext *nsContext = NULL;
-
+
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
nsContext = [NSOpenGLContext currentContext];
[pool release];
@@ -541,7 +541,7 @@ void * getCurrentContext() {
void * getCGLContext(void* nsJContext) {
NSOpenGLContext *nsContext = (NSOpenGLContext*)nsJContext;
void * cglContext = NULL;
-
+
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
cglContext = [nsContext CGLContextObj];
[pool release];
@@ -551,7 +551,7 @@ void * getCGLContext(void* nsJContext) {
void * getNSView(void* nsJContext) {
NSOpenGLContext *nsContext = (NSOpenGLContext*)nsJContext;
void * view = NULL;
-
+
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
view = [nsContext view];
[pool release];
@@ -560,7 +560,7 @@ void * getNSView(void* nsJContext) {
Bool makeCurrentContext(void* nsJContext) {
NSOpenGLContext *nsContext = (NSOpenGLContext*)nsJContext;
-
+
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
[nsContext makeCurrentContext];
[pool release];
@@ -582,7 +582,7 @@ Bool clearCurrentContext(void* nsJContext) {
Bool deleteContext(void* nsJContext) {
NSOpenGLContext *nsContext = (NSOpenGLContext*)nsJContext;
-
+
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
[nsContext clearDrawable];
[nsContext release];
@@ -592,7 +592,7 @@ Bool deleteContext(void* nsJContext) {
Bool flushBuffer(void* nsJContext) {
NSOpenGLContext *nsContext = (NSOpenGLContext*)nsJContext;
-
+
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
[nsContext flushBuffer];
[pool release];
@@ -607,7 +607,7 @@ void setContextOpacity(void* nsJContext, int opacity) {
void updateContext(void* nsJContext) {
NSOpenGLContext *nsContext = (NSOpenGLContext*)nsJContext;
-
+
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
[nsContext update];
[pool release];
@@ -622,7 +622,7 @@ void copyContext(void* destContext, void* srcContext, int mask) {
void* updateContextRegister(void* nsJContext, void* view) {
NSOpenGLContext *nsContext = (NSOpenGLContext*)nsJContext;
NSView *nsView = (NSView*)view;
-
+
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
ContextUpdater *contextUpdater = [[ContextUpdater alloc] init];
[contextUpdater registerFor:nsContext with:nsView];
@@ -632,7 +632,7 @@ void* updateContextRegister(void* nsJContext, void* view) {
void updateContextUnregister(void* updater) {
ContextUpdater *contextUpdater = (ContextUpdater *)updater;
-
+
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
[contextUpdater release];
[pool release];
@@ -653,7 +653,7 @@ void* createPBuffer(int renderTarget, int internalFormat, int width, int height)
Bool destroyPBuffer(void* buffer) {
/* FIXME: not clear whether we need to perform the clearDrawable below */
NSOpenGLPixelBuffer *pBuffer = (NSOpenGLPixelBuffer*)buffer;
-
+
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
/*
if (nsContext != NULL) {
@@ -662,7 +662,7 @@ Bool destroyPBuffer(void* buffer) {
*/
[pBuffer release];
[pool release];
-
+
return true;
}
@@ -701,21 +701,21 @@ void* getProcAddress(const char *procname) {
libGLImage = NSAddImage(libGLStr, options);
libGLUImage = NSAddImage(libGLUStr, options);
}
-
+
unsigned long options = NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR;
char underscoreName[512] = "_";
strcat(underscoreName, procname);
-
+
if (NSIsSymbolNameDefinedInImage(libGLImage, underscoreName) == YES) {
NSSymbol sym = NSLookupSymbolInImage(libGLImage, underscoreName, options);
return NSAddressOfSymbol(sym);
}
-
- if (NSIsSymbolNameDefinedInImage(libGLUImage, underscoreName) == YES) {
+
+ if (NSIsSymbolNameDefinedInImage(libGLUImage, underscoreName) == YES) {
NSSymbol sym = NSLookupSymbolInImage(libGLUImage, underscoreName, options);
return NSAddressOfSymbol(sym);
}
-
+
if (NSIsSymbolNameDefinedWithHint(underscoreName, "GL")) {
NSSymbol sym = NSLookupAndBindSymbol(underscoreName);
return NSAddressOfSymbol(sym);
diff --git a/src/jogl/native/openmax/omx_tool.c b/src/jogl/native/openmax/omx_tool.c
index c6b6494..57fa8ad 100644
--- a/src/jogl/native/openmax/omx_tool.c
+++ b/src/jogl/native/openmax/omx_tool.c
@@ -199,10 +199,10 @@ static OMX_ERRORTYPE EventHandler(
if (pOMXAV->endComponent == hComponent)
{
DBG_PRINT("\t end component - FIN\n");
- pOMXAV->status = OMXAV_FIN;
+ pOMXAV->status = OMXAV_FIN;
}
- }
- break;
+ }
+ break;
case OMX_EventError:
{
if (nData1 == OMX_ErrorIncorrectStateTransition)
@@ -1053,11 +1053,11 @@ void OMXToolBasicAV_SetStream(OMXToolBasicAV_t * pOMXAV, int vBufferNum, const K
{
OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE oActiveClockType;
- INIT_PARAM(oActiveClockType);
- oActiveClockType.eClock = (pOMXAV->audioPort != -1) ?
+ INIT_PARAM(oActiveClockType);
+ oActiveClockType.eClock = (pOMXAV->audioPort != -1) ?
OMX_TIME_RefClockAudio : OMX_TIME_RefClockVideo;
OMXSAFEVOID(OMX_SetConfig(pOMXAV->comp[OMXAV_H_CLOCK], OMX_IndexConfigTimeActiveRefClock,
- &oActiveClockType));
+ &oActiveClockType));
}
OMXSAFEVOID(OMX_SendCommand(pOMXAV->comp[OMXAV_H_CLOCK], OMX_CommandPortDisable, (OMX_U32) -1, 0));
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java
index b43db82..e2e1c5a 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java
@@ -131,7 +131,7 @@ public class DefaultCapabilitiesChooser implements CapabilitiesChooser {
// Don't substitute a positive score for a smaller negative score
if ((scoreClosestToZero == NO_SCORE) ||
(Math.abs(score) < Math.abs(scoreClosestToZero) &&
- ((sign(scoreClosestToZero) < 0) || (sign(score) > 0)))) {
+ ((sign(scoreClosestToZero) < 0) || (sign(score) > 0)))) {
scoreClosestToZero = score;
chosenIndex = i;
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java b/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java
index 96a45b7..0d992d7 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java
@@ -89,7 +89,7 @@ public class Insets implements Cloneable {
}
public String toString() {
- return getClass().getName() + "[top=" + top + ",left=" + left +
+ return getClass().getName() + "[top=" + top + ",left=" + left +
",bottom=" + bottom + ",right=" + right + "]";
}
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
index 0eda5c2..3c16abb 100644
--- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
+++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
@@ -191,7 +191,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
// if ( isShowing() == false ) -> Container was not visible yet.
// if ( isShowing() == true ) -> Container is already visible.
System.err.println("NewtCanvasAWT.addNotify: "+newtChild+", "+this+", visible "+isVisible()+", showing "+isShowing()+
- ", displayable "+isDisplayable()+" -> "+cont);
+ ", displayable "+isDisplayable()+" -> "+cont);
}
reparentWindow(true, cont);
}
diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug427GLJPanelTest1.java b/src/test/com/jogamp/opengl/test/bugs/Bug427GLJPanelTest1.java
index ceee2c8..04ce155 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Bug427GLJPanelTest1.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Bug427GLJPanelTest1.java
@@ -66,7 +66,7 @@ public class Bug427GLJPanelTest1 extends JFrame implements GLEventListener {
public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
}
-
- public void dispose(GLAutoDrawable drawable) {
- }
+
+ public void dispose(GLAutoDrawable drawable) {
+ }
}
diff --git a/src/test/com/jogamp/opengl/test/bugs/Issue326Test1.java b/src/test/com/jogamp/opengl/test/bugs/Issue326Test1.java
index 4c2b547..833f341 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Issue326Test1.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Issue326Test1.java
@@ -32,19 +32,19 @@ public class Issue326Test1 extends Frame implements GLEventListener {
int width, height;
public static void main(String[] args) {
- new Issue326Test1();
+ new Issue326Test1();
}
-
+
GLCanvas canvas;
TextRenderer tr ;
-
+
public Issue326Test1() {
super("TextTest");
this.setSize(800, 800);
canvas = new GLCanvas();
canvas.addGLEventListener(this);
add(canvas);
-
+
setVisible(true);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
@@ -57,20 +57,20 @@ public class Issue326Test1 extends Frame implements GLEventListener {
GL2 gl = drawable.getGL().getGL2();
gl.glClearColor(0, 0, 0, 0);
gl.glClear(GL2.GL_COLOR_BUFFER_BIT|GL2.GL_DEPTH_BUFFER_BIT);
-
-
+
+
gl.glMatrixMode(GL2.GL_PROJECTION);
- gl.glLoadIdentity();
+ gl.glLoadIdentity();
//new GLU().gluPerspective(45f, (float)width/(float)height, 0.1f, 1000f);
gl.glOrtho(0.0, 800, 0.0, 800, -100.0, 100.0);
gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glLoadIdentity();
-
+
tr.beginRendering(800,800);
tr.draw( "die Marktwirtschaft. Da regelt sich � angeblich", 16, 32);
tr.draw( "Hello World! This text is scrambled", 16, 16);
tr.endRendering();
-
+
}
public void init(GLAutoDrawable arg0) {
@@ -90,5 +90,5 @@ public class Issue326Test1 extends Frame implements GLEventListener {
gl.glLoadIdentity();
}
- public void dispose(GLAutoDrawable drawable) {}
+ public void dispose(GLAutoDrawable drawable) {}
}
diff --git a/src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java b/src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java
index 8960c96..ac5d819 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java
@@ -21,19 +21,19 @@ public class Issue326Test2 extends Frame implements GLEventListener {
int width, height;
public static void main(String[] args) {
- new Issue326Test2();
+ new Issue326Test2();
}
-
+
GLCanvas canvas;
TextRenderer tr;
-
+
public Issue326Test2() {
super("");
this.setSize(800, 800);
canvas = new GLCanvas();
canvas.addGLEventListener(this);
add(canvas);
-
+
setVisible(true);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
@@ -46,12 +46,12 @@ public class Issue326Test2 extends Frame implements GLEventListener {
GL2 gl = drawable.getGL().getGL2();
gl.glClearColor(0, 0, 0, 0);
gl.glClear(GL2.GL_COLOR_BUFFER_BIT|GL2.GL_DEPTH_BUFFER_BIT);
-
+
tr.beginRendering(drawable.getWidth(), drawable.getHeight());
tr.draw("LA CLAPI\u00c8RE \nAlt: 1100-1700m \nGlissement de terrain majeur", 16, 80);
tr.draw("dans la haute Tin\u00e9e, sur un flanc du Parc du Mercantour.", 16, 16);
tr.endRendering();
-
+
}
public void init(GLAutoDrawable arg0) {
@@ -68,6 +68,6 @@ public class Issue326Test2 extends Frame implements GLEventListener {
gl.glLoadIdentity();
}
- public void dispose(GLAutoDrawable drawable) {}
+ public void dispose(GLAutoDrawable drawable) {}
}
diff --git a/src/test/com/jogamp/opengl/test/bugs/Issue344Base.java b/src/test/com/jogamp/opengl/test/bugs/Issue344Base.java
index c3401fe..9b0a4c6 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Issue344Base.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Issue344Base.java
@@ -91,7 +91,7 @@ public abstract class Issue344Base implements GLEventListener
h / -2.0f * textScaleFactor,
3f,
textScaleFactor);
-
+
renderer.end3DRendering();
}
@@ -103,5 +103,5 @@ public abstract class Issue344Base implements GLEventListener
glu.gluPerspective(15, (float) width / (float) height, 5, 15);
}
- public void dispose(GLAutoDrawable drawable) {}
+ public void dispose(GLAutoDrawable drawable) {}
}
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 bb7af25..190ddc9 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java
@@ -29,41 +29,41 @@ public class TestRegionRendererNEWT01 extends UITestCase {
org.junit.runner.JUnitCore.main(tstname);
}
- @BeforeClass
- public static void initClass() {
- GLProfile.initSingleton(true);
- NativeWindowFactory.initSingleton(true);
- }
-
- static void destroyWindow(GLWindow window) {
- if(null!=window) {
- window.destroy();
- }
- }
-
- static GLWindow createWindow(String title, GLCapabilitiesImmutable caps, int width, int height) {
- Assert.assertNotNull(caps);
-
- GLWindow window = GLWindow.create(caps);
- window.setSize(width, height);
- window.setPosition(10, 10);
- window.setTitle(title);
- Assert.assertNotNull(window);
- window.setVisible(true);
-
- return window;
- }
-
- @Test
- public void testRegionRendererR2T01() throws InterruptedException {
+ @BeforeClass
+ public static void initClass() {
+ GLProfile.initSingleton(true);
+ NativeWindowFactory.initSingleton(true);
+ }
+
+ static void destroyWindow(GLWindow window) {
+ if(null!=window) {
+ window.destroy();
+ }
+ }
+
+ static GLWindow createWindow(String title, GLCapabilitiesImmutable caps, int width, int height) {
+ Assert.assertNotNull(caps);
+
+ GLWindow window = GLWindow.create(caps);
+ window.setSize(width, height);
+ window.setPosition(10, 10);
+ window.setTitle(title);
+ Assert.assertNotNull(window);
+ window.setVisible(true);
+
+ return window;
+ }
+
+ @Test
+ public void testRegionRendererR2T01() throws InterruptedException {
GLProfile glp = GLProfile.getGL2ES2();
-
- GLCapabilities caps = new GLCapabilities(glp);
- //caps.setOnscreen(false);
- caps.setAlphaBits(4);
+
+ GLCapabilities caps = new GLCapabilities(glp);
+ //caps.setOnscreen(false);
+ caps.setAlphaBits(4);
- GLWindow window = createWindow("shape-r2t1-msaa0", caps, 800,400);
-
+ GLWindow window = createWindow("shape-r2t1-msaa0", caps, 800,400);
+
GPURegionGLListener02 demo02Listener = new GPURegionGLListener02 (Region.TWO_PASS, 1140, false, false);
demo02Listener.attachInputListenerTo(window);
window.addGLEventListener(demo02Listener);
@@ -72,35 +72,35 @@ public class TestRegionRendererNEWT01 extends UITestCase {
window.addGLEventListener(listener);
listener.setTech(-20, 00, 0f, -300, 400);
- window.display();
-
+ window.display();
+
listener.setTech(-20, 00, 0f, -150, 800);
window.display();
-
+
listener.setTech(-20, 00, 0f, -50, 1000);
window.display();
- destroyWindow(window);
- }
-
- @Test
- public void testRegionRendererMSAA01() throws InterruptedException {
- GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
- GLCapabilities caps = new GLCapabilities(glp);
- // caps.setOnscreen(false);
- caps.setAlphaBits(4);
- caps.setSampleBuffers(true);
- caps.setNumSamples(4);
-
- GLWindow window = createWindow("shape-r2t0-msaa1", caps, 800, 400);
-
+ destroyWindow(window);
+ }
+
+ @Test
+ public void testRegionRendererMSAA01() throws InterruptedException {
+ GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
+ GLCapabilities caps = new GLCapabilities(glp);
+ // caps.setOnscreen(false);
+ caps.setAlphaBits(4);
+ caps.setSampleBuffers(true);
+ caps.setNumSamples(4);
+
+ GLWindow window = createWindow("shape-r2t0-msaa1", caps, 800, 400);
+
GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (Region.SINGLE_PASS, 0, false, false);
demo01Listener.attachInputListenerTo(window);
window.addGLEventListener(demo01Listener);
-
- RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion01");
- window.addGLEventListener(listener);
-
+
+ RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion01");
+ window.addGLEventListener(listener);
+
listener.setTech(-20, 00, 0f, -300, 400);
window.display();
@@ -110,39 +110,39 @@ public class TestRegionRendererNEWT01 extends UITestCase {
listener.setTech(-20, 00, 0f, -50, 1000);
window.display();
- destroyWindow(window);
- }
-
- private class RegionGLListener implements GLEventListener {
- String winTitle;
- String name;
- GPURegionRendererListenerBase01 impl;
-
- public RegionGLListener(GPURegionRendererListenerBase01 impl, String title, String name) {
- this.impl = impl;
- this.winTitle = title;
- this.name = name;
- }
-
- public void setTech(float xt, float yt, float angle, int zoom, int fboSize){
- impl.setMatrix(xt, yt, angle, zoom, fboSize);
- }
-
- public void init(GLAutoDrawable drawable) {
- impl.init(drawable);
- }
-
- public void display(GLAutoDrawable drawable) {
- impl.display(drawable);
-
- try {
- impl.printScreen(drawable, "./", winTitle, name, false);
- } catch (GLException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
+ destroyWindow(window);
+ }
+
+ private class RegionGLListener implements GLEventListener {
+ String winTitle;
+ String name;
+ GPURegionRendererListenerBase01 impl;
+
+ public RegionGLListener(GPURegionRendererListenerBase01 impl, String title, String name) {
+ this.impl = impl;
+ this.winTitle = title;
+ this.name = name;
+ }
+
+ public void setTech(float xt, float yt, float angle, int zoom, int fboSize){
+ impl.setMatrix(xt, yt, angle, zoom, fboSize);
+ }
+
+ public void init(GLAutoDrawable drawable) {
+ impl.init(drawable);
+ }
+
+ public void display(GLAutoDrawable drawable) {
+ impl.display(drawable);
+
+ try {
+ impl.printScreen(drawable, "./", winTitle, name, false);
+ } catch (GLException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
public void dispose(GLAutoDrawable drawable) {
impl.dispose(drawable);
@@ -153,5 +153,5 @@ public class TestRegionRendererNEWT01 extends UITestCase {
impl.reshape(drawable, x, y, width, height);
}
- }
+ }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java
index 92b9323..1ef7962 100755
--- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java
@@ -33,51 +33,51 @@ public class TestTextRendererNEWT01 extends UITestCase {
org.junit.runner.JUnitCore.main(tstname);
}
- @BeforeClass
- public static void initClass() {
- GLProfile.initSingleton(true);
- NativeWindowFactory.initSingleton(true);
- }
-
- static void destroyWindow(GLWindow window) {
- if(null!=window) {
- window.destroy();
- }
- }
-
- static GLWindow createWindow(String title, GLCapabilitiesImmutable caps, int width, int height) {
- Assert.assertNotNull(caps);
-
- GLWindow window = GLWindow.create(caps);
- window.setSize(width, height);
- window.setPosition(10, 10);
- window.setTitle(title);
- Assert.assertNotNull(window);
- window.setVisible(true);
-
- return window;
- }
-
- @Test
- public void testTextRendererR2T01() throws InterruptedException {
+ @BeforeClass
+ public static void initClass() {
+ GLProfile.initSingleton(true);
+ NativeWindowFactory.initSingleton(true);
+ }
+
+ static void destroyWindow(GLWindow window) {
+ if(null!=window) {
+ window.destroy();
+ }
+ }
+
+ static GLWindow createWindow(String title, GLCapabilitiesImmutable caps, int width, int height) {
+ Assert.assertNotNull(caps);
+
+ GLWindow window = GLWindow.create(caps);
+ window.setSize(width, height);
+ window.setPosition(10, 10);
+ window.setTitle(title);
+ Assert.assertNotNull(window);
+ window.setVisible(true);
+
+ return window;
+ }
+
+ @Test
+ public void testTextRendererR2T01() throws InterruptedException {
GLProfile glp = GLProfile.getGL2ES2();
-
- GLCapabilities caps = new GLCapabilities(glp);
- caps.setAlphaBits(4);
+
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setAlphaBits(4);
- GLWindow window = createWindow("text-r2t1-msaa0", caps, 800,400);
- TextGLListener textGLListener = new TextGLListener(Region.TWO_PASS, DEBUG, TRACE);
+ GLWindow window = createWindow("text-r2t1-msaa0", caps, 800,400);
+ TextGLListener textGLListener = new TextGLListener(Region.TWO_PASS, DEBUG, TRACE);
textGLListener.attachInputListenerTo(window);
window.addGLEventListener(textGLListener);
textGLListener.setFontSet(FontFactory.UBUNTU, 0, 0);
textGLListener.setTech(-400, -30, 0f, -1000, window.getWidth()*2);
- window.display();
-
- textGLListener.setTech(-400, -30, 0, -380, window.getWidth()*3);
window.display();
-
- textGLListener.setTech(-400, -20, 0, -80, window.getWidth()*4);
+
+ textGLListener.setTech(-400, -30, 0, -380, window.getWidth()*3);
+ window.display();
+
+ textGLListener.setTech(-400, -20, 0, -80, window.getWidth()*4);
window.display();
textGLListener.setFontSet(FontFactory.JAVA, 0, 0);
@@ -90,19 +90,19 @@ public class TestTextRendererNEWT01 extends UITestCase {
textGLListener.setTech(-400, -20, 0, -80, window.getWidth()*4);
window.display();
- destroyWindow(window);
- }
-
- @Test
- public void testTextRendererMSAA01() throws InterruptedException {
- GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
- GLCapabilities caps = new GLCapabilities(glp);
- caps.setAlphaBits(4);
- caps.setSampleBuffers(true);
- caps.setNumSamples(4);
-
- GLWindow window = createWindow("text-r2t0-msaa1", caps, 800, 400);
- TextGLListener textGLListener = new TextGLListener(Region.SINGLE_PASS, DEBUG, TRACE);
+ destroyWindow(window);
+ }
+
+ @Test
+ public void testTextRendererMSAA01() throws InterruptedException {
+ GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setAlphaBits(4);
+ caps.setSampleBuffers(true);
+ caps.setNumSamples(4);
+
+ GLWindow window = createWindow("text-r2t0-msaa1", caps, 800, 400);
+ TextGLListener textGLListener = new TextGLListener(Region.SINGLE_PASS, DEBUG, TRACE);
textGLListener.attachInputListenerTo(window);
window.addGLEventListener(textGLListener);
@@ -126,48 +126,48 @@ public class TestTextRendererNEWT01 extends UITestCase {
textGLListener.setTech(-400, -20, 0, -80, 0);
window.display();
- destroyWindow(window);
- }
-
- private class TextGLListener extends GPUTextRendererListenerBase01 {
- String winTitle;
-
- public TextGLListener(int type, boolean debug, boolean trace) {
- super(SVertex.factory(), type, debug, trace);
- }
-
- public void attachInputListenerTo(GLWindow window) {
- super.attachInputListenerTo(window);
- winTitle = window.getTitle();
- }
- public void setTech(float xt, float yt, float angle, int zoom, int fboSize){
- setMatrix(xt, yt, angle, zoom, fboSize);
- }
-
- public void init(GLAutoDrawable drawable) {
+ destroyWindow(window);
+ }
+
+ private class TextGLListener extends GPUTextRendererListenerBase01 {
+ String winTitle;
+
+ public TextGLListener(int type, boolean debug, boolean trace) {
+ super(SVertex.factory(), type, debug, trace);
+ }
+
+ public void attachInputListenerTo(GLWindow window) {
+ super.attachInputListenerTo(window);
+ winTitle = window.getTitle();
+ }
+ public void setTech(float xt, float yt, float angle, int zoom, int fboSize){
+ setMatrix(xt, yt, angle, zoom, fboSize);
+ }
+
+ public void init(GLAutoDrawable drawable) {
super.init(drawable);
- GL2ES2 gl = drawable.getGL().getGL2ES2();
- gl.setSwapInterval(1);
- gl.glEnable(GL.GL_DEPTH_TEST);
-
- final TextRenderer textRenderer = (TextRenderer) getRenderer();
-
- textRenderer.init(gl);
- textRenderer.setAlpha(gl, 1.0f);
- textRenderer.setColor(gl, 0.0f, 0.0f, 0.0f);
- }
-
- public void display(GLAutoDrawable drawable) {
- super.display(drawable);
-
- try {
- printScreen(drawable, "./", winTitle, false);
- } catch (GLException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
+ GL2ES2 gl = drawable.getGL().getGL2ES2();
+ gl.setSwapInterval(1);
+ gl.glEnable(GL.GL_DEPTH_TEST);
+
+ final TextRenderer textRenderer = (TextRenderer) getRenderer();
+
+ textRenderer.init(gl);
+ textRenderer.setAlpha(gl, 1.0f);
+ textRenderer.setColor(gl, 0.0f, 0.0f, 0.0f);
+ }
+
+ public void display(GLAutoDrawable drawable) {
+ super.display(drawable);
+
+ try {
+ printScreen(drawable, "./", winTitle, false);
+ } catch (GLException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
}
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 bf4bfab..7975f18 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
@@ -43,60 +43,60 @@ import com.jogamp.graph.geom.opengl.SVertex;
*
*/
public class GPURegionGLListener01 extends GPURegionRendererListenerBase01 {
- OutlineShape outlineShape = null;
-
- public GPURegionGLListener01 (int numpass, int fbosize, boolean debug, boolean trace) {
+ OutlineShape outlineShape = null;
+
+ public GPURegionGLListener01 (int numpass, int fbosize, boolean debug, boolean trace) {
super(SVertex.factory(), numpass, debug, trace);
setMatrix(-20, 00, 0f, -50, fbosize);
- }
-
- private void createTestOutline(){
- float offset = 0;
- outlineShape = new OutlineShape(getRenderer().getFactory());
- outlineShape.addVertex(0.0f,-10.0f, true);
- outlineShape.addVertex(15.0f,-10.0f, true);
- outlineShape.addVertex(10.0f,5.0f, false);
- outlineShape.addVertex(15.0f,10.0f, true);
- outlineShape.addVertex(6.0f,15.0f, false);
- outlineShape.addVertex(5.0f,8.0f, false);
- outlineShape.addVertex(0.0f,10.0f,true);
- outlineShape.closeLastOutline();
- outlineShape.addEmptyOutline();
- outlineShape.addVertex(5.0f,-5.0f,true);
- outlineShape.addVertex(10.0f,-5.0f, false);
- outlineShape.addVertex(10.0f,0.0f, true);
- outlineShape.addVertex(5.0f,0.0f, false);
- outlineShape.closeLastOutline();
-
- /** Same shape as above but without any off-curve vertices */
- outlineShape.addEmptyOutline();
- offset = 30;
- outlineShape.addVertex(offset+0.0f,-10.0f, true);
- outlineShape.addVertex(offset+17.0f,-10.0f, true);
- outlineShape.addVertex(offset+11.0f,5.0f, true);
- outlineShape.addVertex(offset+16.0f,10.0f, true);
- outlineShape.addVertex(offset+7.0f,15.0f, true);
- outlineShape.addVertex(offset+6.0f,8.0f, true);
- outlineShape.addVertex(offset+0.0f,10.0f, true);
- outlineShape.closeLastOutline();
- outlineShape.addEmptyOutline();
- outlineShape.addVertex(offset+5.0f,0.0f, true);
- outlineShape.addVertex(offset+5.0f,-5.0f, true);
- outlineShape.addVertex(offset+10.0f,-5.0f, true);
- outlineShape.addVertex(offset+10.0f,0.0f, true);
- outlineShape.closeLastOutline();
- }
+ }
+
+ private void createTestOutline(){
+ float offset = 0;
+ outlineShape = new OutlineShape(getRenderer().getFactory());
+ outlineShape.addVertex(0.0f,-10.0f, true);
+ outlineShape.addVertex(15.0f,-10.0f, true);
+ outlineShape.addVertex(10.0f,5.0f, false);
+ outlineShape.addVertex(15.0f,10.0f, true);
+ outlineShape.addVertex(6.0f,15.0f, false);
+ outlineShape.addVertex(5.0f,8.0f, false);
+ outlineShape.addVertex(0.0f,10.0f,true);
+ outlineShape.closeLastOutline();
+ outlineShape.addEmptyOutline();
+ outlineShape.addVertex(5.0f,-5.0f,true);
+ outlineShape.addVertex(10.0f,-5.0f, false);
+ outlineShape.addVertex(10.0f,0.0f, true);
+ outlineShape.addVertex(5.0f,0.0f, false);
+ outlineShape.closeLastOutline();
+
+ /** Same shape as above but without any off-curve vertices */
+ outlineShape.addEmptyOutline();
+ offset = 30;
+ outlineShape.addVertex(offset+0.0f,-10.0f, true);
+ outlineShape.addVertex(offset+17.0f,-10.0f, true);
+ outlineShape.addVertex(offset+11.0f,5.0f, true);
+ outlineShape.addVertex(offset+16.0f,10.0f, true);
+ outlineShape.addVertex(offset+7.0f,15.0f, true);
+ outlineShape.addVertex(offset+6.0f,8.0f, true);
+ outlineShape.addVertex(offset+0.0f,10.0f, true);
+ outlineShape.closeLastOutline();
+ outlineShape.addEmptyOutline();
+ outlineShape.addVertex(offset+5.0f,0.0f, true);
+ outlineShape.addVertex(offset+5.0f,-5.0f, true);
+ outlineShape.addVertex(offset+10.0f,-5.0f, true);
+ outlineShape.addVertex(offset+10.0f,0.0f, true);
+ outlineShape.closeLastOutline();
+ }
- public void init(GLAutoDrawable drawable) {
- super.init(drawable);
-
+ public void init(GLAutoDrawable drawable) {
+ super.init(drawable);
+
GL2ES2 gl = drawable.getGL().getGL2ES2();
final RegionRenderer regionRenderer = (RegionRenderer) getRenderer();
- gl.setSwapInterval(1);
- gl.glEnable(GL2ES2.GL_DEPTH_TEST);
- regionRenderer.init(gl);
+ gl.setSwapInterval(1);
+ gl.glEnable(GL2ES2.GL_DEPTH_TEST);
+ regionRenderer.init(gl);
regionRenderer.setAlpha(gl, 1.0f);
regionRenderer.setColor(gl, 0.0f, 0.0f, 0.0f);
//gl.glSampleCoverage(0.95f, false);
@@ -104,21 +104,21 @@ public class GPURegionGLListener01 extends GPURegionRendererListenerBase01 {
//gl.glEnable(GL2GL3.GL_SAMPLE_ALPHA_TO_ONE);
MSAATool.dump(drawable);
- createTestOutline();
- }
+ createTestOutline();
+ }
- public void display(GLAutoDrawable drawable) {
- GL2ES2 gl = drawable.getGL().getGL2ES2();
+ public void display(GLAutoDrawable drawable) {
+ GL2ES2 gl = drawable.getGL().getGL2ES2();
- gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
- gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
+ gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
final RegionRenderer regionRenderer = (RegionRenderer) getRenderer();
- regionRenderer.resetModelview(null);
- regionRenderer.translate(null, getXTran(), getYTran(), getZoom());
- regionRenderer.rotate(gl, getAngle(), 0, 1, 0);
+ regionRenderer.resetModelview(null);
+ regionRenderer.translate(null, getXTran(), getYTran(), getZoom());
+ regionRenderer.rotate(gl, getAngle(), 0, 1, 0);
- regionRenderer.renderOutlineShape(gl, outlineShape, getPosition(), getTexSize());
- }
+ regionRenderer.renderOutlineShape(gl, outlineShape, getPosition(), getTexSize());
+ }
}
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 56db37e..5a54b65 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
@@ -47,7 +47,7 @@ public class GPURegionGLListener02 extends GPURegionRendererListenerBase01 {
super(SVertex.factory(), numpass, debug, trace);
setMatrix(-20, 00, 0f, -50, fbosize);
}
-
+
private void createTestOutline(){
float offset = 0;
outlineShapes[0] = new OutlineShape(SVertex.factory());
@@ -85,24 +85,24 @@ public class GPURegionGLListener02 extends GPURegionRendererListenerBase01 {
outlineShapes[1].closeLastOutline();
}
- public void init(GLAutoDrawable drawable) {
- super.init(drawable);
-
+ public void init(GLAutoDrawable drawable) {
+ super.init(drawable);
+
GL2ES2 gl = drawable.getGL().getGL2ES2();
final RegionRenderer regionRenderer = (RegionRenderer) getRenderer();
- gl.setSwapInterval(1);
- gl.glEnable(GL2ES2.GL_DEPTH_TEST);
- regionRenderer.init(gl);
+ gl.setSwapInterval(1);
+ gl.glEnable(GL2ES2.GL_DEPTH_TEST);
+ regionRenderer.init(gl);
regionRenderer.setAlpha(gl, 1.0f);
regionRenderer.setColor(gl, 0.0f, 0.0f, 0.0f);
MSAATool.dump(drawable);
- createTestOutline();
- }
+ createTestOutline();
+ }
- public void display(GLAutoDrawable drawable) {
+ public void display(GLAutoDrawable drawable) {
GL2ES2 gl = drawable.getGL().getGL2ES2();
gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
@@ -115,6 +115,6 @@ public class GPURegionGLListener02 extends GPURegionRendererListenerBase01 {
regionRenderer.rotate(gl, getAngle(), 0, 1, 0);
regionRenderer.renderOutlineShapes(gl, outlineShapes, getPosition(), getTexSize());
-
- }
+
+ }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java
index dbd5fe1..e31da11 100755
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java
@@ -47,7 +47,7 @@ public class GPURegionNewtDemo01 {
static final boolean TRACE = false;
public static void main(String[] args) {
- GLProfile.initSingleton(true);
+ GLProfile.initSingleton(true);
GLProfile glp = GLProfile.getGL2ES2();
GLCapabilities caps = new GLCapabilities(glp);
caps.setAlphaBits(4);
@@ -65,11 +65,11 @@ public class GPURegionNewtDemo01 {
window.addGLEventListener(regionGLListener);
window.enablePerfLog(true);
- window.setVisible(true);
+ window.setVisible(true);
- //FPSAnimator animator = new FPSAnimator(60);
+ //FPSAnimator animator = new FPSAnimator(60);
Animator animator = new Animator();
- animator.add(window);
- animator.start();
- }
+ animator.add(window);
+ animator.start();
+ }
}
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
index 7ffab59..a7ff0de 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo02.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo02.java
@@ -49,8 +49,8 @@ public class GPURegionNewtDemo02 {
}
public void testMe() {
- GLProfile.initSingleton(true);
- GLProfile glp = GLProfile.getGL2ES2();
+ GLProfile.initSingleton(true);
+ GLProfile glp = GLProfile.getGL2ES2();
GLCapabilities caps = new GLCapabilities(glp);
caps.setAlphaBits(4);
System.out.println("Requested: " + caps);
@@ -65,11 +65,11 @@ public class GPURegionNewtDemo02 {
window.addGLEventListener(regionGLListener);
window.enablePerfLog(true);
- window.setVisible(true);
+ window.setVisible(true);
- //FPSAnimator animator = new FPSAnimator(60);
+ //FPSAnimator animator = new FPSAnimator(60);
Animator animator = new Animator();
- animator.add(window);
- animator.start();
- }
+ animator.add(window);
+ animator.start();
+ }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java
index e63985b..fa3e851 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java
@@ -166,8 +166,8 @@ public abstract class GPURendererListenerBase01 implements GLEventListener {
PrintWriter pw = new PrintWriter(sw);
pw.printf("-%03dx%03d-Z%04d-T%04d-%s", drawable.getWidth(), drawable.getHeight(), (int)Math.abs(zoom), texSize, objName);
- String filename = dir + tech + sw +".tga";
- screenshot.surface2File(drawable, filename /*, exportAlpha */);
+ String filename = dir + tech + sw +".tga";
+ screenshot.surface2File(drawable, filename /*, exportAlpha */);
}
int screenshot_num = 0;
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java
index 7290246..a62219a 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java
@@ -36,26 +36,26 @@ import com.jogamp.graph.geom.opengl.SVertex;
public class GPUTextGLListener0A extends GPUTextRendererListenerBase01 {
public GPUTextGLListener0A(int numpass, int fbosize, boolean debug, boolean trace) {
- super(SVertex.factory(), numpass, debug, trace);
- setMatrix(-400, -30, 0f, -500, fbosize);
- }
-
- public void init(GLAutoDrawable drawable) {
+ super(SVertex.factory(), numpass, debug, trace);
+ setMatrix(-400, -30, 0f, -500, fbosize);
+ }
+
+ public void init(GLAutoDrawable drawable) {
super.init(drawable);
GL2ES2 gl = drawable.getGL().getGL2ES2();
final TextRenderer textRenderer = (TextRenderer) getRenderer();
- gl.setSwapInterval(1);
- gl.glEnable(GL2ES2.GL_DEPTH_TEST);
- textRenderer.init(gl);
- textRenderer.setAlpha(gl, 1.0f);
- textRenderer.setColor(gl, 0.0f, 0.0f, 0.0f);
- //gl.glSampleCoverage(0.95f, false);
- //gl.glEnable(GL2GL3.GL_SAMPLE_COVERAGE); // sample coverage doesn't really make a difference to lines
- //gl.glEnable(GL2GL3.GL_SAMPLE_ALPHA_TO_COVERAGE);
- //gl.glEnable(GL2GL3.GL_SAMPLE_ALPHA_TO_ONE);
- MSAATool.dump(drawable);
- }
+ gl.setSwapInterval(1);
+ gl.glEnable(GL2ES2.GL_DEPTH_TEST);
+ textRenderer.init(gl);
+ textRenderer.setAlpha(gl, 1.0f);
+ textRenderer.setColor(gl, 0.0f, 0.0f, 0.0f);
+ //gl.glSampleCoverage(0.95f, false);
+ //gl.glEnable(GL2GL3.GL_SAMPLE_COVERAGE); // sample coverage doesn't really make a difference to lines
+ //gl.glEnable(GL2GL3.GL_SAMPLE_ALPHA_TO_COVERAGE);
+ //gl.glEnable(GL2GL3.GL_SAMPLE_ALPHA_TO_ONE);
+ MSAATool.dump(drawable);
+ }
}
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
index 3739f28..086007d 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java
@@ -39,29 +39,29 @@ public class GPUTextNewtDemo01 {
static final boolean DEBUG = false;
static final boolean TRACE = false;
- public static void main(String[] args) {
- GLProfile.initSingleton(true);
- 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);
-
- GLWindow window = GLWindow.create(caps);
- window.setPosition(10, 10);
- window.setSize(800, 400);
- window.setTitle("GPU Text Newt Demo 01 - r2t0 msaa1");
-
- GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(Region.SINGLE_PASS, 0, DEBUG, TRACE);
- textGLListener.attachInputListenerTo(window);
- window.addGLEventListener(textGLListener);
+ public static void main(String[] args) {
+ GLProfile.initSingleton(true);
+ 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);
+
+ GLWindow window = GLWindow.create(caps);
+ window.setPosition(10, 10);
+ window.setSize(800, 400);
+ window.setTitle("GPU Text Newt Demo 01 - r2t0 msaa1");
+
+ GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(Region.SINGLE_PASS, 0, DEBUG, TRACE);
+ textGLListener.attachInputListenerTo(window);
+ window.addGLEventListener(textGLListener);
- window.enablePerfLog(true);
- window.setVisible(true);
- // FPSAnimator animator = new FPSAnimator(10);
- Animator animator = new Animator();
- animator.add(window);
- animator.start();
- }
+ window.enablePerfLog(true);
+ window.setVisible(true);
+ // FPSAnimator animator = new FPSAnimator(10);
+ Animator animator = new Animator();
+ animator.add(window);
+ 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
index 1b4a945..f44e01c 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java
@@ -50,17 +50,17 @@ public class GPUTextNewtDemo02 {
static final boolean TRACE = false;
public static void main(String[] args) {
- GLProfile.initSingleton(true);
+ GLProfile.initSingleton(true);
GLProfile glp = GLProfile.getGL2ES2();
-
- GLCapabilities caps = new GLCapabilities(glp);
- caps.setAlphaBits(4);
- System.out.println("Requested: "+caps);
-
- GLWindow window = GLWindow.create(caps);
-
- window.setPosition(10, 10);
- window.setSize(800, 400);
+
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setAlphaBits(4);
+ System.out.println("Requested: "+caps);
+
+ GLWindow window = GLWindow.create(caps);
+
+ window.setPosition(10, 10);
+ window.setSize(800, 400);
window.setTitle("GPU Text Newt Demo 02 - r2t1 msaa0");
GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(Region.TWO_PASS, window.getWidth()*3, DEBUG, TRACE);
@@ -69,10 +69,10 @@ public class GPUTextNewtDemo02 {
window.addGLEventListener(textGLListener);
window.enablePerfLog(true);
- window.setVisible(true);
- // FPSAnimator animator = new FPSAnimator(60);
- Animator animator = new Animator();
- animator.add(window);
- animator.start();
- }
+ window.setVisible(true);
+ // FPSAnimator animator = new FPSAnimator(60);
+ Animator animator = new Animator();
+ animator.add(window);
+ animator.start();
+ }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/MSAATool.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/MSAATool.java
index 5975e09..1fbedb3 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/MSAATool.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/MSAATool.java
@@ -33,37 +33,37 @@ import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCapabilitiesImmutable;
public class MSAATool {
- public static void dump(GLAutoDrawable drawable) {
- float[] vf = new float[] { 0f };
- byte[] vb = new byte[] { 0 };
- int[] vi = new int[] { 0, 0 };
-
- System.out.println("GL MSAA SETUP:");
- GL2ES2 gl = drawable.getGL().getGL2ES2();
- GLCapabilitiesImmutable caps = drawable.getChosenGLCapabilities();
- System.out.println(" Caps realised "+caps);
- System.out.println(" Caps sample buffers "+caps.getSampleBuffers()+", samples "+caps.getNumSamples());
-
- // default TRUE
- System.out.println(" GL MULTISAMPLE "+gl.glIsEnabled(GL2ES2.GL_MULTISAMPLE));
- // sample buffers min 0, same as GLX_SAMPLE_BUFFERS_ARB or WGL_SAMPLE_BUFFERS_ARB
- gl.glGetIntegerv(GL2GL3.GL_SAMPLE_BUFFERS, vi, 0);
- // samples min 0
- gl.glGetIntegerv(GL2GL3.GL_SAMPLES, vi, 1);
- System.out.println(" GL SAMPLE_BUFFERS "+vi[0]+", SAMPLES "+vi[1]);
-
- System.out.println("GL CSAA SETUP:");
- // default FALSE
- System.out.println(" GL SAMPLE COVERAGE "+gl.glIsEnabled(GL2GL3.GL_SAMPLE_COVERAGE));
- // default FALSE
- System.out.println(" GL SAMPLE_ALPHA_TO_COVERAGE "+gl.glIsEnabled(GL2GL3.GL_SAMPLE_ALPHA_TO_COVERAGE));
- // default FALSE
- System.out.println(" GL SAMPLE_ALPHA_TO_ONE "+gl.glIsEnabled(GL2GL3.GL_SAMPLE_ALPHA_TO_ONE));
- // default FALSE, value 1, invert false
- gl.glGetFloatv(GL2GL3.GL_SAMPLE_COVERAGE_VALUE, vf, 0);
- gl.glGetBooleanv(GL2GL3.GL_SAMPLE_COVERAGE_INVERT, vb, 0);
- System.out.println(" GL SAMPLE_COVERAGE "+gl.glIsEnabled(GL2GL3.GL_SAMPLE_COVERAGE) +
- ": SAMPLE_COVERAGE_VALUE "+vf[0]+
- ", SAMPLE_COVERAGE_INVERT "+vb[0]);
- }
+ public static void dump(GLAutoDrawable drawable) {
+ float[] vf = new float[] { 0f };
+ byte[] vb = new byte[] { 0 };
+ int[] vi = new int[] { 0, 0 };
+
+ System.out.println("GL MSAA SETUP:");
+ GL2ES2 gl = drawable.getGL().getGL2ES2();
+ GLCapabilitiesImmutable caps = drawable.getChosenGLCapabilities();
+ System.out.println(" Caps realised "+caps);
+ System.out.println(" Caps sample buffers "+caps.getSampleBuffers()+", samples "+caps.getNumSamples());
+
+ // default TRUE
+ System.out.println(" GL MULTISAMPLE "+gl.glIsEnabled(GL2ES2.GL_MULTISAMPLE));
+ // sample buffers min 0, same as GLX_SAMPLE_BUFFERS_ARB or WGL_SAMPLE_BUFFERS_ARB
+ gl.glGetIntegerv(GL2GL3.GL_SAMPLE_BUFFERS, vi, 0);
+ // samples min 0
+ gl.glGetIntegerv(GL2GL3.GL_SAMPLES, vi, 1);
+ System.out.println(" GL SAMPLE_BUFFERS "+vi[0]+", SAMPLES "+vi[1]);
+
+ System.out.println("GL CSAA SETUP:");
+ // default FALSE
+ System.out.println(" GL SAMPLE COVERAGE "+gl.glIsEnabled(GL2GL3.GL_SAMPLE_COVERAGE));
+ // default FALSE
+ System.out.println(" GL SAMPLE_ALPHA_TO_COVERAGE "+gl.glIsEnabled(GL2GL3.GL_SAMPLE_ALPHA_TO_COVERAGE));
+ // default FALSE
+ System.out.println(" GL SAMPLE_ALPHA_TO_ONE "+gl.glIsEnabled(GL2GL3.GL_SAMPLE_ALPHA_TO_ONE));
+ // default FALSE, value 1, invert false
+ gl.glGetFloatv(GL2GL3.GL_SAMPLE_COVERAGE_VALUE, vf, 0);
+ gl.glGetBooleanv(GL2GL3.GL_SAMPLE_COVERAGE_INVERT, vb, 0);
+ System.out.println(" GL SAMPLE_COVERAGE "+gl.glIsEnabled(GL2GL3.GL_SAMPLE_COVERAGE) +
+ ": SAMPLE_COVERAGE_VALUE "+vf[0]+
+ ", SAMPLE_COVERAGE_INVERT "+vb[0]);
+ }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RIButton.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RIButton.java
index 4f59b61..cb9154c 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RIButton.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RIButton.java
@@ -37,168 +37,168 @@ import com.jogamp.graph.geom.Vertex.Factory;
/** GPU based resolution independent Button impl
*/
public class RIButton extends UIControl{
- private float width = 4.0f, height= 3.0f;
- private float spacing = 0.3f;
- private float[] scale = new float[]{1.0f,1.0f};
- private float corner = 0.5f;
- private float labelZOffset = -0.05f;
-
- private float[] buttonColor = {0.0f, 0.0f, 0.0f};
- private float[] labelColor = {1.0f, 1.0f, 1.0f};
-
- public RIButton(Factory<? extends Vertex> factory, String label){
- super(factory);
- this.label = label;
- setFont(FontFactory.get(FontFactory.UBUNTU).getDefault());
- }
+ private float width = 4.0f, height= 3.0f;
+ private float spacing = 0.3f;
+ private float[] scale = new float[]{1.0f,1.0f};
+ private float corner = 0.5f;
+ private float labelZOffset = -0.05f;
+
+ private float[] buttonColor = {0.0f, 0.0f, 0.0f};
+ private float[] labelColor = {1.0f, 1.0f, 1.0f};
+
+ public RIButton(Factory<? extends Vertex> factory, String label){
+ super(factory);
+ this.label = label;
+ setFont(FontFactory.get(FontFactory.UBUNTU).getDefault());
+ }
- public RIButton(Factory<? extends Vertex> factory, String label, Font font){
- super(factory);
- setLabel(label);
- setFont(font);
- }
-
- public float getWidth() {
- return width;
- }
+ public RIButton(Factory<? extends Vertex> factory, String label, Font font){
+ super(factory);
+ setLabel(label);
+ setFont(font);
+ }
+
+ public float getWidth() {
+ return width;
+ }
- public void setDimensions(float width, float height) {
- this.width = width;
- this.height = height;
- setDirty(true);
- }
+ public void setDimensions(float width, float height) {
+ this.width = width;
+ this.height = height;
+ setDirty(true);
+ }
- public float getHeight() {
- return height;
- }
+ public float getHeight() {
+ return height;
+ }
- public Font getFont() {
- return font;
- }
-
- public void generate(AABBox lbox) {
-// AABBox lbox = font.getStringBounds(label, 10);
- createOutline(factory, lbox);
- scale[0] = getWidth()/(2*spacing + lbox.getWidth());
- scale[1] = getHeight()/(2*spacing + lbox.getHeight());
-
- //FIXME: generate GlyphString to manipulate before rendering
- setDirty(false);
- }
-
-
- public float[] getScale() {
- return scale;
- }
+ public Font getFont() {
+ return font;
+ }
+
+ public void generate(AABBox lbox) {
+// AABBox lbox = font.getStringBounds(label, 10);
+ createOutline(factory, lbox);
+ scale[0] = getWidth()/(2*spacing + lbox.getWidth());
+ scale[1] = getHeight()/(2*spacing + lbox.getHeight());
+
+ //FIXME: generate GlyphString to manipulate before rendering
+ setDirty(false);
+ }
+
+
+ public float[] getScale() {
+ return scale;
+ }
- private void createOutline(Factory<? extends Vertex> factory, AABBox lbox){
- shape = new OutlineShape(factory);
- if(corner == 0.0f){
- createSharpOutline(lbox);
- }
- else{
- createCurvedOutline(lbox);
- }
- }
- private void createSharpOutline(AABBox lbox){
- float th = (2.0f*spacing) + lbox.getHeight();
- float tw = (2.0f*spacing) + lbox.getWidth();
- float minX = lbox.getMinX()-spacing;
- float minY = lbox.getMinY()-spacing;
-
- shape.addVertex(minX, minY, labelZOffset, true);
- shape.addVertex(minX+tw, minY, labelZOffset, true);
- shape.addVertex(minX+tw, minY + th, labelZOffset, true);
- shape.addVertex(minX, minY + th, labelZOffset, true);
- shape.closeLastOutline();
- }
-
- private void createCurvedOutline(AABBox lbox){
- float th = 2.0f*spacing + lbox.getHeight();
- float tw = 2.0f*spacing + lbox.getWidth();
-
- float cw = 0.5f*corner*Math.min(tw, th);
- float ch = 0.5f*corner*Math.min(tw, th);
-
- float minX = lbox.getMinX()-spacing;
- float minY = lbox.getMinY()-spacing;
-
- shape.addVertex(minX, minY + ch, labelZOffset, true);
- shape.addVertex(minX, minY, labelZOffset, false);
- shape.addVertex(minX + cw, minY, labelZOffset, true);
- shape.addVertex(minX + tw - cw, minY, labelZOffset, true);
- shape.addVertex(minX + tw, minY, labelZOffset, false);
- shape.addVertex(minX + tw, minY + ch, labelZOffset, true);
- shape.addVertex(minX + tw, minY + th- ch, labelZOffset, true);
- shape.addVertex(minX + tw, minY + th, labelZOffset, false);
- shape.addVertex(minX + tw - cw, minY + th, labelZOffset, true);
- shape.addVertex(minX + cw, minY + th, labelZOffset, true);
- shape.addVertex(minX, minY + th, labelZOffset, false);
- shape.addVertex(minX, minY + th - ch, labelZOffset, true);
- shape.closeLastOutline();
- }
+ private void createOutline(Factory<? extends Vertex> factory, AABBox lbox){
+ shape = new OutlineShape(factory);
+ if(corner == 0.0f){
+ createSharpOutline(lbox);
+ }
+ else{
+ createCurvedOutline(lbox);
+ }
+ }
+ private void createSharpOutline(AABBox lbox){
+ float th = (2.0f*spacing) + lbox.getHeight();
+ float tw = (2.0f*spacing) + lbox.getWidth();
+ float minX = lbox.getMinX()-spacing;
+ float minY = lbox.getMinY()-spacing;
+
+ shape.addVertex(minX, minY, labelZOffset, true);
+ shape.addVertex(minX+tw, minY, labelZOffset, true);
+ shape.addVertex(minX+tw, minY + th, labelZOffset, true);
+ shape.addVertex(minX, minY + th, labelZOffset, true);
+ shape.closeLastOutline();
+ }
+
+ private void createCurvedOutline(AABBox lbox){
+ float th = 2.0f*spacing + lbox.getHeight();
+ float tw = 2.0f*spacing + lbox.getWidth();
+
+ float cw = 0.5f*corner*Math.min(tw, th);
+ float ch = 0.5f*corner*Math.min(tw, th);
+
+ float minX = lbox.getMinX()-spacing;
+ float minY = lbox.getMinY()-spacing;
+
+ shape.addVertex(minX, minY + ch, labelZOffset, true);
+ shape.addVertex(minX, minY, labelZOffset, false);
+ shape.addVertex(minX + cw, minY, labelZOffset, true);
+ shape.addVertex(minX + tw - cw, minY, labelZOffset, true);
+ shape.addVertex(minX + tw, minY, labelZOffset, false);
+ shape.addVertex(minX + tw, minY + ch, labelZOffset, true);
+ shape.addVertex(minX + tw, minY + th- ch, labelZOffset, true);
+ shape.addVertex(minX + tw, minY + th, labelZOffset, false);
+ shape.addVertex(minX + tw - cw, minY + th, labelZOffset, true);
+ shape.addVertex(minX + cw, minY + th, labelZOffset, true);
+ shape.addVertex(minX, minY + th, labelZOffset, false);
+ shape.addVertex(minX, minY + th - ch, labelZOffset, true);
+ shape.closeLastOutline();
+ }
- public float getCorner() {
- return corner;
- }
+ public float getCorner() {
+ return corner;
+ }
- public void setCorner(float corner) {
- if(corner > 1.0f){
- this.corner = 1.0f;
- }
- else if(corner < 0.01f){
- this.corner = 0.0f;
- }
- else{
- this.corner = corner;
- }
- setDirty(true);
- }
-
- public float getLabelZOffset() {
- return labelZOffset;
- }
+ public void setCorner(float corner) {
+ if(corner > 1.0f){
+ this.corner = 1.0f;
+ }
+ else if(corner < 0.01f){
+ this.corner = 0.0f;
+ }
+ else{
+ this.corner = corner;
+ }
+ setDirty(true);
+ }
+
+ public float getLabelZOffset() {
+ return labelZOffset;
+ }
- public void setLabelZOffset(float labelZOffset) {
- this.labelZOffset = -labelZOffset;
- setDirty(true);
- }
- public float getSpacing() {
- return spacing;
- }
+ public void setLabelZOffset(float labelZOffset) {
+ this.labelZOffset = -labelZOffset;
+ setDirty(true);
+ }
+ public float getSpacing() {
+ return spacing;
+ }
- public void setSpacing(float spacing) {
- if(spacing < 0.0f){
- this.spacing = 0.0f;
- }
- else{
- this.spacing = spacing;
- }
- setDirty(true);
- }
-
- public float[] getButtonColor() {
- return buttonColor;
- }
+ public void setSpacing(float spacing) {
+ if(spacing < 0.0f){
+ this.spacing = 0.0f;
+ }
+ else{
+ this.spacing = spacing;
+ }
+ setDirty(true);
+ }
+
+ public float[] getButtonColor() {
+ return buttonColor;
+ }
- public void setButtonColor(float r, float g, float b) {
- this.buttonColor[0] = r;
- this.buttonColor[1] = g;
- this.buttonColor[2] = b;
- }
+ public void setButtonColor(float r, float g, float b) {
+ this.buttonColor[0] = r;
+ this.buttonColor[1] = g;
+ this.buttonColor[2] = b;
+ }
- public float[] getLabelColor() {
- return labelColor;
- }
+ public float[] getLabelColor() {
+ return labelColor;
+ }
- public void setLabelColor(float r, float g, float b) {
- this.labelColor[0] = r;
- this.labelColor[1] = g;
- this.labelColor[2] = b;
- }
-
- public String toString(){
- return "RIButton [ label: " + getLabel() + "," + "spacing: " + spacing
- + ", " + "corner: " + corner + ", " + "shapeOffset: " + labelZOffset + " ]";
- }
+ public void setLabelColor(float r, float g, float b) {
+ this.labelColor[0] = r;
+ this.labelColor[1] = g;
+ this.labelColor[2] = b;
+ }
+
+ public String toString(){
+ return "RIButton [ label: " + getLabel() + "," + "spacing: " + spacing
+ + ", " + "corner: " + corner + ", " + "shapeOffset: " + labelZOffset + " ]";
+ }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIControl.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIControl.java
index ae872fe..a4f1152 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIControl.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIControl.java
@@ -34,47 +34,47 @@ import com.jogamp.graph.geom.Vertex;
import com.jogamp.graph.geom.Vertex.Factory;
public abstract class UIControl {
- protected Font font = null;
- protected OutlineShape shape = null;
- protected String label = "Label";
- protected Factory<? extends Vertex> factory;
-
- protected boolean dirty = true;
+ protected Font font = null;
+ protected OutlineShape shape = null;
+ protected String label = "Label";
+ protected Factory<? extends Vertex> factory;
+
+ protected boolean dirty = true;
- public UIControl(Factory<? extends Vertex> factory){
- this.factory = factory;
- }
-
- public abstract void generate(AABBox lbox);
+ public UIControl(Factory<? extends Vertex> factory){
+ this.factory = factory;
+ }
+
+ public abstract void generate(AABBox lbox);
- public Font getFont() {
- return font;
- }
+ public Font getFont() {
+ return font;
+ }
- public void setFont(Font font) {
- this.font = font;
- }
+ public void setFont(Font font) {
+ this.font = font;
+ }
- public OutlineShape getShape(AABBox lbox) {
- if(isDirty()){
- generate(lbox);
- }
- return shape;
- }
-
- public String getLabel(){
- return label;
- }
- public void setLabel(String label) {
- this.label = label;
- setDirty(true);
- }
-
- protected boolean isDirty() {
- return dirty;
- }
+ public OutlineShape getShape(AABBox lbox) {
+ if(isDirty()){
+ generate(lbox);
+ }
+ return shape;
+ }
+
+ public String getLabel(){
+ return label;
+ }
+ public void setLabel(String label) {
+ this.label = label;
+ setDirty(true);
+ }
+
+ protected boolean isDirty() {
+ return dirty;
+ }
- protected void setDirty(boolean dirty) {
- this.dirty = dirty;
- }
+ protected void setDirty(boolean dirty) {
+ this.dirty = dirty;
+ }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java
index cb373d0..1d4903e 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java
@@ -41,10 +41,10 @@ import com.jogamp.graph.geom.opengl.SVertex;
import com.jogamp.opengl.test.junit.graph.demos.MSAATool;
public class UIGLListener01 extends UIListenerBase01 {
-
- public UIGLListener01 (boolean debug, boolean trace) {
+
+ public UIGLListener01 (boolean debug, boolean trace) {
super(RegionRenderer.create(SVertex.factory(), Region.SINGLE_PASS),
- TextRenderer.create(SVertex.factory(), Region.SINGLE_PASS), debug, trace);
+ TextRenderer.create(SVertex.factory(), Region.SINGLE_PASS), debug, trace);
setMatrix(-20, 00, 0f, -50);
button = new RIButton(SVertex.factory(), "Click me!");
button.setLabelColor(1.0f,1.0f,1.0f);
@@ -52,20 +52,20 @@ public class UIGLListener01 extends UIListenerBase01 {
button.setCorner(0.5f);
button.setSpacing(0.3f);
System.err.println(button);
- }
-
- private GlyphString glyphString;
- public void init(GLAutoDrawable drawable) {
- super.init(drawable);
-
+ }
+
+ private GlyphString glyphString;
+ public void init(GLAutoDrawable drawable) {
+ super.init(drawable);
+
GL2ES2 gl = drawable.getGL().getGL2ES2();
final RegionRenderer regionRenderer = getRegionRenderer();
final TextRenderer textRenderer = getTextRenderer();
- gl.setSwapInterval(1);
- gl.glEnable(GL2ES2.GL_DEPTH_TEST);
- gl.glEnable(GL2ES2.GL_POLYGON_OFFSET_FILL);
+ gl.setSwapInterval(1);
+ gl.glEnable(GL2ES2.GL_DEPTH_TEST);
+ gl.glEnable(GL2ES2.GL_POLYGON_OFFSET_FILL);
regionRenderer.init(gl);
regionRenderer.setAlpha(gl, 1.0f);
@@ -75,29 +75,29 @@ public class UIGLListener01 extends UIListenerBase01 {
button.generate(glyphString.getBounds());
MSAATool.dump(drawable);
- }
+ }
- public void display(GLAutoDrawable drawable) {
- GL2ES2 gl = drawable.getGL().getGL2ES2();
+ public void display(GLAutoDrawable drawable) {
+ GL2ES2 gl = drawable.getGL().getGL2ES2();
- gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
- gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
+ gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
final RegionRenderer regionRenderer = getRegionRenderer();
- regionRenderer.resetModelview(null);
-
- regionRenderer.translate(null, getXTran(), getYTran(), getZoom());
- regionRenderer.rotate(gl, getAngle(), 0, 1, 0);
- float[] bColor = button.getButtonColor();
- regionRenderer.setColor(gl, bColor[0], bColor[1], bColor[2]);
- regionRenderer.renderOutlineShape(gl, button.getShape(glyphString.getBounds()), getPosition(), 0);
- float[] lColor = button.getLabelColor();
- regionRenderer.setColor(gl, lColor[0], lColor[1], lColor[2]);
- glyphString.renderString3D();
- }
- public void dispose(GLAutoDrawable drawable) {
- super.dispose(drawable);
- glyphString.destroy();
- }
+ regionRenderer.resetModelview(null);
+
+ regionRenderer.translate(null, getXTran(), getYTran(), getZoom());
+ regionRenderer.rotate(gl, getAngle(), 0, 1, 0);
+ float[] bColor = button.getButtonColor();
+ regionRenderer.setColor(gl, bColor[0], bColor[1], bColor[2]);
+ regionRenderer.renderOutlineShape(gl, button.getShape(glyphString.getBounds()), getPosition(), 0);
+ float[] lColor = button.getLabelColor();
+ regionRenderer.setColor(gl, lColor[0], lColor[1], lColor[2]);
+ glyphString.renderString3D();
+ }
+ public void dispose(GLAutoDrawable drawable) {
+ super.dispose(drawable);
+ glyphString.destroy();
+ }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java
index fb4d101..67cb5cb 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java
@@ -66,8 +66,8 @@ public abstract class UIListenerBase01 implements GLEventListener {
private boolean debug;
private boolean trace;
- protected RIButton button;
-
+ protected RIButton button;
+
private KeyAction keyAction;
private MouseAction mouseAction;
@@ -161,7 +161,7 @@ public abstract class UIListenerBase01 implements GLEventListener {
window.addKeyListener(keyAction);
}
if ( null == mouseAction ) {
- mouseAction = new MouseAction();
+ mouseAction = new MouseAction();
window.addMouseListener(mouseAction);
}
}
@@ -183,8 +183,8 @@ public abstract class UIListenerBase01 implements GLEventListener {
PrintWriter pw = new PrintWriter(sw);
pw.printf("-%03dx%03d-Z%04d-T%04d-%s", drawable.getWidth(), drawable.getHeight(), (int)Math.abs(zoom), 0, objName);
- String filename = dir + tech + sw +".tga";
- screenshot.surface2File(drawable, filename /*, exportAlpha */);
+ String filename = dir + tech + sw +".tga";
+ screenshot.surface2File(drawable, filename /*, exportAlpha */);
}
int screenshot_num = 0;
@@ -198,44 +198,44 @@ public abstract class UIListenerBase01 implements GLEventListener {
public class MouseAction implements MouseListener{
- public void mouseClicked(MouseEvent e) {
-
- }
+ public void mouseClicked(MouseEvent e) {
+
+ }
- public void mouseEntered(MouseEvent e) {
- }
+ public void mouseEntered(MouseEvent e) {
+ }
- public void mouseExited(MouseEvent e) {
- }
+ public void mouseExited(MouseEvent e) {
+ }
- public void mousePressed(MouseEvent e) {
- button.setLabelColor(0.8f,0.8f,0.8f);
- button.setButtonColor(0.1f, 0.1f, 0.1f);
- }
+ public void mousePressed(MouseEvent e) {
+ button.setLabelColor(0.8f,0.8f,0.8f);
+ button.setButtonColor(0.1f, 0.1f, 0.1f);
+ }
- public void mouseReleased(MouseEvent e) {
- button.setLabelColor(1.0f,1.0f,1.0f);
- button.setButtonColor(0.6f,0.6f,0.6f);
- }
+ public void mouseReleased(MouseEvent e) {
+ button.setLabelColor(1.0f,1.0f,1.0f);
+ button.setButtonColor(0.6f,0.6f,0.6f);
+ }
- @Override
- public void mouseMoved(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
+ @Override
+ public void mouseMoved(MouseEvent e) {
+ // TODO Auto-generated method stub
+
+ }
- @Override
- public void mouseDragged(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
+ @Override
+ public void mouseDragged(MouseEvent e) {
+ // TODO Auto-generated method stub
+
+ }
- @Override
- public void mouseWheelMoved(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
+ @Override
+ public void mouseWheelMoved(MouseEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
}
public class KeyAction implements KeyListener {
@@ -267,7 +267,7 @@ public abstract class UIListenerBase01 implements GLEventListener {
System.err.println("Button Spacing: " + button.getSpacing());
}
else if(arg0.getKeyCode() == KeyEvent.VK_5){
- button.setSpacing(button.getSpacing()+0.1f);
+ button.setSpacing(button.getSpacing()+0.1f);
System.err.println("Button Spacing: " + button.getSpacing());
}
else if(arg0.getKeyCode() == KeyEvent.VK_6){
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java
index 98e74e3..167177e 100755
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java
@@ -46,7 +46,7 @@ public class UINewtDemo01 {
static final boolean TRACE = false;
public static void main(String[] args) {
- GLProfile.initSingleton(true);
+ GLProfile.initSingleton(true);
GLProfile glp = GLProfile.getGL2ES2();
GLCapabilities caps = new GLCapabilities(glp);
caps.setAlphaBits(4);
@@ -64,10 +64,10 @@ public class UINewtDemo01 {
window.addGLEventListener(uiGLListener);
window.enablePerfLog(true);
- window.setVisible(true);
+ window.setVisible(true);
Animator animator = new Animator();
- animator.add(window);
- animator.start();
- }
+ animator.add(window);
+ animator.start();
+ }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TestAWTTextRendererUseVertexArrayBug464.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TestAWTTextRendererUseVertexArrayBug464.java
index fc19a68..5475d34 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TestAWTTextRendererUseVertexArrayBug464.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TestAWTTextRendererUseVertexArrayBug464.java
@@ -90,7 +90,7 @@ public class TestAWTTextRendererUseVertexArrayBug464 extends UITestCase {
@After
public void cleanupTest() {
- frame.setVisible(false);
+ frame.setVisible(false);
frame.remove(glCanvas);
glCanvas=null;
Assert.assertNotNull(frame);
@@ -107,15 +107,15 @@ public class TestAWTTextRendererUseVertexArrayBug464 extends UITestCase {
Animator animator = new Animator(glCanvas);
animator.start();
-
- Thread.sleep(500); // 500 ms
-
- animator.stop();
+
+ Thread.sleep(500); // 500 ms
+
+ animator.stop();
- String disallowedMethods = listener.getDisallowedMethodCalls();
- if (!disallowedMethods.equals("")) {
- Assert.fail("Following VBO-related glMethods have been called: "+ disallowedMethods);
- }
+ String disallowedMethods = listener.getDisallowedMethodCalls();
+ if (!disallowedMethods.equals("")) {
+ Assert.fail("Following VBO-related glMethods have been called: "+ disallowedMethods);
+ }
}
@Test
@@ -127,15 +127,15 @@ public class TestAWTTextRendererUseVertexArrayBug464 extends UITestCase {
Animator animator = new Animator(glCanvas);
animator.start();
-
- Thread.sleep(500); // 500 ms
-
- animator.stop();
+
+ Thread.sleep(500); // 500 ms
+
+ animator.stop();
- String disallowedMethods = listener.getDisallowedMethodCalls();
- if (!disallowedMethods.equals("")) {
- Assert.fail("Following VBO-related glMethods have been called: "+ disallowedMethods);
- }
+ String disallowedMethods = listener.getDisallowedMethodCalls();
+ if (!disallowedMethods.equals("")) {
+ Assert.fail("Following VBO-related glMethods have been called: "+ disallowedMethods);
+ }
}
public static void main(String args[]) throws IOException {
@@ -151,5 +151,5 @@ public class TestAWTTextRendererUseVertexArrayBug464 extends UITestCase {
"logtestlistenerevents=true",
"formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter",
"formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } );
- }
+ }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererGLEventListener01.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererGLEventListener01.java
index b147041..c966845 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererGLEventListener01.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererGLEventListener01.java
@@ -75,9 +75,9 @@ public class TextRendererGLEventListener01 implements GLEventListener {
Assert.assertFalse(renderer.getUseVertexArrays());
text = "ABC123#+?";
-
- PrintStream nullStream = new PrintStream(new OutputStream(){ public void write(int b){}});
- drawable.setGL(new TextRendererTraceGL2Mock01(drawable.getGL().getGL2(), nullStream, this));
+
+ PrintStream nullStream = new PrintStream(new OutputStream(){ public void write(int b){}});
+ drawable.setGL(new TextRendererTraceGL2Mock01(drawable.getGL().getGL2(), nullStream, this));
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
@@ -90,35 +90,35 @@ public class TextRendererGLEventListener01 implements GLEventListener {
}
public void dispose(GLAutoDrawable drawable) {
- renderer.dispose();
+ renderer.dispose();
}
public void display(GLAutoDrawable drawable) {
if (disallowedMethodCalls.equals("")) {
- if (testNumber == 1) {
- renderer.beginRendering(drawable.getWidth(), drawable.getHeight());
+ if (testNumber == 1) {
+ renderer.beginRendering(drawable.getWidth(), drawable.getHeight());
renderer.setColor(1.0f, 1.0f, 1.0f, 1.0f);
renderer.draw(text, 0, 0);
renderer.endRendering();
- }
- if (testNumber == 2) {
- renderer.begin3DRendering();
- renderer.setColor(1.0f, 1.0f, 1.0f, 1.0f);
- renderer.draw3D(text, 0, 0, 0, 0.002f);
- renderer.end3DRendering();
- }
+ }
+ if (testNumber == 2) {
+ renderer.begin3DRendering();
+ renderer.setColor(1.0f, 1.0f, 1.0f, 1.0f);
+ renderer.draw3D(text, 0, 0, 0, 0.002f);
+ renderer.end3DRendering();
+ }
}
}
public void disallowedMethodCalled (String method) {
- if (!disallowedMethodCalls.equals("")) {
- disallowedMethodCalls += ", ";
- }
- disallowedMethodCalls += method;
+ if (!disallowedMethodCalls.equals("")) {
+ disallowedMethodCalls += ", ";
+ }
+ disallowedMethodCalls += method;
}
public String getDisallowedMethodCalls() {
- return this.disallowedMethodCalls;
+ return this.disallowedMethodCalls;
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererTraceGL2Mock01.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererTraceGL2Mock01.java
index 63258a5..86714fc 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererTraceGL2Mock01.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererTraceGL2Mock01.java
@@ -63,75 +63,75 @@ import com.jogamp.common.nio.Buffers;
*/
public class TextRendererTraceGL2Mock01 extends TraceGL2 {
-
- TextRendererGLEventListener01 listener;
-
- public TextRendererTraceGL2Mock01(GL2 downstreamGL2, PrintStream stream, TextRendererGLEventListener01 listener) {
- super(downstreamGL2, stream);
- this.listener = listener;
- }
-
- @Override
- public void glGetBufferSubData(int arg0, long arg1, long arg2, Buffer arg3) {
- listener.disallowedMethodCalled("glGetBufferSubData");
- }
-
- @Override
- public ByteBuffer glMapBuffer(int arg0, int arg1) {
- listener.disallowedMethodCalled("glMapBuffer");
- return Buffers.newDirectByteBuffer(0);
- }
-
- @Override
- public void glGetBufferParameteriv(int arg0, int arg1, IntBuffer arg2) {
- listener.disallowedMethodCalled("glGetBufferParameteriv");
- }
-
- @Override
- public boolean glUnmapBuffer(int arg0) {
- listener.disallowedMethodCalled("glUnmapBuffer");
- return false;
- }
-
- @Override
- public void glGenBuffers(int arg0, IntBuffer arg1) {
- listener.disallowedMethodCalled("glGenBuffers");
- }
-
- @Override
- public void glGenBuffers(int arg0, int[] arg1, int arg2) {
- listener.disallowedMethodCalled("glGenBuffers");
- }
-
- @Override
- public boolean glIsBuffer(int arg0) {
- listener.disallowedMethodCalled("glIsBuffer");
- return false;
- }
-
- @Override
- public void glBindBuffer(int arg0, int arg1) {
- listener.disallowedMethodCalled("glBindBuffer");
- }
-
- @Override
- public void glDeleteBuffers(int arg0, int[] arg1, int arg2) {
- listener.disallowedMethodCalled("glDeleteBuffers");
- }
-
- @Override
- public void glBufferSubData(int arg0, long arg1, long arg2, Buffer arg3) {
- listener.disallowedMethodCalled("glBufferSubData");
- }
-
- @Override
- public void glGetBufferParameteriv(int arg0, int arg1, int[] arg2, int arg3) {
- listener.disallowedMethodCalled("glGetBufferParameteriv");
- }
-
- @Override
- public void glBufferData(int arg0, long arg1, Buffer arg2, int arg3) {
- listener.disallowedMethodCalled("glBufferData");
- }
+
+ TextRendererGLEventListener01 listener;
+
+ public TextRendererTraceGL2Mock01(GL2 downstreamGL2, PrintStream stream, TextRendererGLEventListener01 listener) {
+ super(downstreamGL2, stream);
+ this.listener = listener;
+ }
+
+ @Override
+ public void glGetBufferSubData(int arg0, long arg1, long arg2, Buffer arg3) {
+ listener.disallowedMethodCalled("glGetBufferSubData");
+ }
+
+ @Override
+ public ByteBuffer glMapBuffer(int arg0, int arg1) {
+ listener.disallowedMethodCalled("glMapBuffer");
+ return Buffers.newDirectByteBuffer(0);
+ }
+
+ @Override
+ public void glGetBufferParameteriv(int arg0, int arg1, IntBuffer arg2) {
+ listener.disallowedMethodCalled("glGetBufferParameteriv");
+ }
+
+ @Override
+ public boolean glUnmapBuffer(int arg0) {
+ listener.disallowedMethodCalled("glUnmapBuffer");
+ return false;
+ }
+
+ @Override
+ public void glGenBuffers(int arg0, IntBuffer arg1) {
+ listener.disallowedMethodCalled("glGenBuffers");
+ }
+
+ @Override
+ public void glGenBuffers(int arg0, int[] arg1, int arg2) {
+ listener.disallowedMethodCalled("glGenBuffers");
+ }
+
+ @Override
+ public boolean glIsBuffer(int arg0) {
+ listener.disallowedMethodCalled("glIsBuffer");
+ return false;
+ }
+
+ @Override
+ public void glBindBuffer(int arg0, int arg1) {
+ listener.disallowedMethodCalled("glBindBuffer");
+ }
+
+ @Override
+ public void glDeleteBuffers(int arg0, int[] arg1, int arg2) {
+ listener.disallowedMethodCalled("glDeleteBuffers");
+ }
+
+ @Override
+ public void glBufferSubData(int arg0, long arg1, long arg2, Buffer arg3) {
+ listener.disallowedMethodCalled("glBufferSubData");
+ }
+
+ @Override
+ public void glGetBufferParameteriv(int arg0, int arg1, int[] arg2, int arg3) {
+ listener.disallowedMethodCalled("glGetBufferParameteriv");
+ }
+
+ @Override
+ public void glBufferData(int arg0, long arg1, Buffer arg2, int arg3) {
+ listener.disallowedMethodCalled("glBufferData");
+ }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/TestGearsGLJPanelAWTBug450.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/TestGearsGLJPanelAWTBug450.java
index cd26825..c8e45ec 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/TestGearsGLJPanelAWTBug450.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/TestGearsGLJPanelAWTBug450.java
@@ -87,20 +87,20 @@ public class TestGearsGLJPanelAWTBug450 extends UITestCase {
GLJPanel glJPanel = new GLJPanel(caps);
Assert.assertNotNull(glJPanel);
glJPanel.addGLEventListener(new Gears() {
- @Override
- public void display(GLAutoDrawable drawable) {
- super.display(drawable);
- // look at one pixel at the bottom of the frame, just right of
- // the center line, and make sure it's not black
- GL2 gl = GLUgl2.getCurrentGL2();
- ByteBuffer bytebuffer = ByteBuffer.allocateDirect( 3 );
- gl.glReadPixels( 260, 10, 1, 1, GL2.GL_BGR, GL2.GL_UNSIGNED_BYTE, bytebuffer );
- byte byte0 = bytebuffer.get( 0 );
- byte byte1 = bytebuffer.get( 1 );
- byte byte2 = bytebuffer.get( 2 );
- if( (byte0 == 0) && (byte1 == 0) && (byte2 == 0) )
- failed = true;
- }
+ @Override
+ public void display(GLAutoDrawable drawable) {
+ super.display(drawable);
+ // look at one pixel at the bottom of the frame, just right of
+ // the center line, and make sure it's not black
+ GL2 gl = GLUgl2.getCurrentGL2();
+ ByteBuffer bytebuffer = ByteBuffer.allocateDirect( 3 );
+ gl.glReadPixels( 260, 10, 1, 1, GL2.GL_BGR, GL2.GL_UNSIGNED_BYTE, bytebuffer );
+ byte byte0 = bytebuffer.get( 0 );
+ byte byte1 = bytebuffer.get( 1 );
+ byte byte2 = bytebuffer.get( 2 );
+ if( (byte0 == 0) && (byte1 == 0) && (byte2 == 0) )
+ failed = true;
+ }
});
FPSAnimator animator = new FPSAnimator(glJPanel, 60);
@@ -129,7 +129,7 @@ public class TestGearsGLJPanelAWTBug450 extends UITestCase {
Assert.assertEquals(false, animator.isAnimating());
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
- _frame.setVisible(false);
+ _frame.setVisible(false);
_frame.getContentPane().remove(_glJPanel);
_frame.remove(_glJPanel);
_glJPanel.destroy();
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode00NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode00NEWT.java
index 7de63e6..d16330e 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode00NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode00NEWT.java
@@ -95,7 +95,7 @@ public class TestScreenMode00NEWT extends UITestCase {
@Test
public void testScreenModeInfo01() throws InterruptedException {
- Capabilities caps = new Capabilities();
+ Capabilities caps = new Capabilities();
Window window = NewtFactory.createWindow(caps);
window.setSize(width, height);
window.setVisible(true);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java
index ffff682..032300b 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java
@@ -88,7 +88,7 @@ public class TestScreenMode01NEWT extends UITestCase {
@Test
public void testFullscreenChange01() throws InterruptedException {
- GLCapabilities caps = new GLCapabilities(glp);
+ GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
Display display = NewtFactory.createDisplay(null); // local display
Assert.assertNotNull(display);
@@ -110,7 +110,7 @@ public class TestScreenMode01NEWT extends UITestCase {
Thread.sleep(waitTimeShort);
animator.stop();
- destroyWindow(window);
+ destroyWindow(window);
}
@Test
@@ -217,7 +217,7 @@ public class TestScreenMode01NEWT extends UITestCase {
}
protected void testScreenModeChangeWithFS01Impl(boolean preFS) throws InterruptedException {
- GLCapabilities caps = new GLCapabilities(glp);
+ GLCapabilities caps = new GLCapabilities(glp);
Display display = NewtFactory.createDisplay(null); // local display
Screen screen = NewtFactory.createScreen(display, 0); // screen 0
GLWindow window = createWindow(screen, caps, width, height, true /* onscreen */, false /* undecorated */);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java
index 1c155f7..dde1253 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java
@@ -152,21 +152,21 @@ public class TestParenting01cSwingAWT extends UITestCase {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
- System.out.println("Demos: 3 - !Visible");
+ System.out.println("Demos: 3 - !Visible");
_jFrame1.setVisible(false);
} });
Assert.assertEquals(true, glWindow1.isValid());
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
- System.out.println("Demos: 4 - Visible");
+ System.out.println("Demos: 4 - Visible");
_jFrame1.setVisible(true);
} });
Assert.assertEquals(true, glWindow1.isValid());
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
- System.out.println("Demos: 5 - X Container");
+ System.out.println("Demos: 5 - X Container");
_jPanel1.remove(_container1);
} });
// Assert.assertNull(glWindow1.getParent());