diff options
author | Philip Jordan <[email protected]> | 2019-10-25 18:16:43 +1300 |
---|---|---|
committer | Philip Jordan <[email protected]> | 2019-10-25 18:16:43 +1300 |
commit | c05f0d55e448af9d956cae051cfffdbf2053677d (patch) | |
tree | 372cf54bfcbee4f96d3063e8ed231c40ccdd7b9e | |
parent | 7e122e7557ad71f0ea76ea248032235c19b00d25 (diff) |
QuadArray usage warning improved to advise how to convert easily.
QuadArrays now render as triangle arrays in order to show where the
issue is.
-rw-r--r-- | src/main/java/org/jogamp/java3d/Jogl2es2DEPPipeline.java | 1 | ||||
-rw-r--r-- | src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java | 39 |
2 files changed, 35 insertions, 5 deletions
diff --git a/src/main/java/org/jogamp/java3d/Jogl2es2DEPPipeline.java b/src/main/java/org/jogamp/java3d/Jogl2es2DEPPipeline.java index b9d8066..d702517 100644 --- a/src/main/java/org/jogamp/java3d/Jogl2es2DEPPipeline.java +++ b/src/main/java/org/jogamp/java3d/Jogl2es2DEPPipeline.java @@ -32,7 +32,6 @@ abstract class Jogl2es2DEPPipeline extends Pipeline + "Coordinates must be defined and float type, colors must be float type, if defined. \n"// + "Decaling is not supported. \n"// + "Model Clip is not supported and must be reimplemented in shaders \n"// - + "QuadArray or IndexedQuadArray cannot be supported. \n"// + "Texture Coordinate generation ignored, must be done in shaders. \n" // + "Texture Lod, Filter, Sharpen and Combine cannot be supported. \n"// + "Texture3D cannot be supported. \n"// diff --git a/src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java b/src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java index 934e9b8..de2af22 100644 --- a/src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java +++ b/src/main/java/org/jogamp/java3d/Jogl2es2Pipeline.java @@ -121,6 +121,9 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline // setPosition on a GLWindow can lock-up if true // also with on and offscreen must be false too private static final boolean NEVER_RELEASE_CONTEXT = false; + + + private static boolean quadArrayCautionPrinted = false; /** * Constructor for singleton JoglPipeline instance @@ -761,7 +764,14 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline switch (geo_type) { case GeometryRetained.GEO_TYPE_QUAD_SET: - System.err.println("QuadArray.\n" + VALID_FORMAT_MESSAGE); + if(!quadArrayCautionPrinted) { + System.err.println("QuadArray will render incorrectly, consider using TriangleArray. If you have the java3d-utils in the buildpath you can convert like this:"); + System.err.println("GeometryInfo gi = new GeometryInfo(quadArray);"); + System.err.println("gi.convertToIndexedTriangles(); "); + System.err.println("GeometryArray ga = gi.getIndexedGeometryArray(true, true, true, true, true);"); + quadArrayCautionPrinted = true; + } + //fallthrough case GeometryRetained.GEO_TYPE_TRI_SET: gl.glDrawArrays(GL2ES2.GL_TRIANGLES, 0, vcount); break; @@ -1468,7 +1478,14 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline switch (geo_type) { case GeometryRetained.GEO_TYPE_QUAD_SET: - System.err.println("QuadArray.\n" + VALID_FORMAT_MESSAGE); + if(!quadArrayCautionPrinted) { + System.err.println("QuadArray will render incorrectly, consider using TriangleArray. If you have the java3d-utils in the buildpath you can convert like this:"); + System.err.println("GeometryInfo gi = new GeometryInfo(quadArray);"); + System.err.println("gi.convertToIndexedTriangles(); "); + System.err.println("GeometryArray ga = gi.getIndexedGeometryArray(true, true, true, true, true);"); + quadArrayCautionPrinted = true; + } + //fallthrough case GeometryRetained.GEO_TYPE_TRI_SET: gl.glDrawArrays(GL2ES2.GL_TRIANGLES, 0, vertexCount); break; @@ -2110,7 +2127,14 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline switch (geo_type) { case GeometryRetained.GEO_TYPE_INDEXED_QUAD_SET: - throw new UnsupportedOperationException("QuadArray.\n" + VALID_FORMAT_MESSAGE); + if(!quadArrayCautionPrinted) { + System.err.println("QuadArray will render incorrectly, consider using TriangleArray. If you have the java3d-utils in the buildpath you can convert like this:"); + System.err.println("GeometryInfo gi = new GeometryInfo(quadArray);"); + System.err.println("gi.convertToIndexedTriangles(); "); + System.err.println("GeometryArray ga = gi.getIndexedGeometryArray(true, true, true, true, true);"); + quadArrayCautionPrinted = true; + } + //fallthrough case GeometryRetained.GEO_TYPE_INDEXED_TRI_SET: gl.glDrawElements(GL2ES2.GL_TRIANGLES, indexCount, GL2ES2.GL_UNSIGNED_SHORT, 0); break; @@ -2886,7 +2910,14 @@ class Jogl2es2Pipeline extends Jogl2es2DEPPipeline switch (geo_type) { case GeometryRetained.GEO_TYPE_INDEXED_QUAD_SET: - throw new UnsupportedOperationException("QuadArray.\n" + VALID_FORMAT_MESSAGE); + if(!quadArrayCautionPrinted) { + System.err.println("QuadArray will render incorrectly, consider using TriangleArray. If you have the java3d-utils in the buildpath you can convert like this:"); + System.err.println("GeometryInfo gi = new GeometryInfo(quadArray);"); + System.err.println("gi.convertToIndexedTriangles(); "); + System.err.println("GeometryArray ga = gi.getIndexedGeometryArray(true, true, true, true, true);"); + quadArrayCautionPrinted = true; + } + //fallthrough case GeometryRetained.GEO_TYPE_INDEXED_TRI_SET: gl.glDrawElements(GL2ES2.GL_TRIANGLES, validIndexCount, GL2ES2.GL_UNSIGNED_SHORT, 0); break; |