diff options
5 files changed, 46 insertions, 18 deletions
diff --git a/src/main/java/org/jogamp/java3d/CanvasViewCache.java b/src/main/java/org/jogamp/java3d/CanvasViewCache.java index 1edb33e..1532a81 100644 --- a/src/main/java/org/jogamp/java3d/CanvasViewCache.java +++ b/src/main/java/org/jogamp/java3d/CanvasViewCache.java @@ -589,9 +589,11 @@ class CanvasViewCache extends Object { // 0.666x0.666 = 0.444 scaling. This is not a Java3D issue. try { final Graphics2D g2d = (Graphics2D) canvas.getGraphics(); - final AffineTransform t = g2d.getTransform(); - hiDPIXScale = t.getScaleX(); - hiDPIYScale = t.getScaleY(); + if (g2d != null) { + final AffineTransform t = g2d.getTransform(); + hiDPIXScale = t.getScaleX(); + hiDPIYScale = t.getScaleY(); + } } catch (IllegalComponentStateException e) {} metersPerPixelX = screenViewCache.metersPerPixelX; 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 4b6162e..e9e12e0 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; diff --git a/src/main/java/org/jogamp/java3d/JoglPipeline.java b/src/main/java/org/jogamp/java3d/JoglPipeline.java index 8e1b160..df6ef80 100644 --- a/src/main/java/org/jogamp/java3d/JoglPipeline.java +++ b/src/main/java/org/jogamp/java3d/JoglPipeline.java @@ -8373,7 +8373,8 @@ static boolean hasFBObjectSizeChanged(JoglDrawable jdraw, int width, int height) if (gct.getSceneAntialiasing() != GraphicsConfigTemplate.UNNECESSARY && gct.getDoubleBuffer() != GraphicsConfigTemplate.UNNECESSARY) { caps.setSampleBuffers(true); - caps.setNumSamples(2); + int numSamples = MasterControl.getIntegerProperty("j3d.numSamples", 2); + caps.setNumSamples(numSamples); } else { caps.setSampleBuffers(false); caps.setNumSamples(0); diff --git a/src/main/java/org/jogamp/java3d/MasterControl.java b/src/main/java/org/jogamp/java3d/MasterControl.java index a7495cf..2d4f573 100644 --- a/src/main/java/org/jogamp/java3d/MasterControl.java +++ b/src/main/java/org/jogamp/java3d/MasterControl.java @@ -806,20 +806,15 @@ private static String getProperty(final String prop) { }); } - static int getIntegerProperty(String prop, int defaultValue) - { + static int getIntegerProperty(String prop, int defaultValue) { int value = defaultValue; String propValue = getProperty(prop); - if (propValue != null) - { - try - { + if (propValue != null) { + try { value = Integer.parseInt(propValue); } - catch (NumberFormatException e) - { - } + catch (NumberFormatException e) { } } if (J3dDebug.debug) System.err.println("Java 3D: " + prop + "=" + value); |