From dfad04062e389254f80517ce8a9efca79eb40856 Mon Sep 17 00:00:00 2001 From: Emmanuel Puybaret Date: Sun, 30 Oct 2016 12:58:43 -0700 Subject: j3dcore: add handling for the new j3d.numSamples property Override the number of canvas samples using a new Integer property, add a helper to MasterControl similar to the existing Boolean property methods. Signed-off-by: Harvey Harrison --- src/javax/media/j3d/JoglPipeline.java | 16 ++++++++-------- src/javax/media/j3d/MasterControl.java | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/javax/media/j3d/JoglPipeline.java b/src/javax/media/j3d/JoglPipeline.java index d528ad7..b29048f 100644 --- a/src/javax/media/j3d/JoglPipeline.java +++ b/src/javax/media/j3d/JoglPipeline.java @@ -52,6 +52,7 @@ import java.util.StringTokenizer; import java.util.regex.Matcher; import java.util.regex.Pattern; +import com.jogamp.common.nio.Buffers; import com.jogamp.nativewindow.AbstractGraphicsDevice; import com.jogamp.nativewindow.AbstractGraphicsScreen; import com.jogamp.nativewindow.CapabilitiesChooser; @@ -61,7 +62,12 @@ import com.jogamp.nativewindow.NativeWindowFactory; import com.jogamp.nativewindow.ProxySurface; import com.jogamp.nativewindow.UpstreamSurfaceHook; import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.nativewindow.awt.AWTGraphicsConfiguration; +import com.jogamp.nativewindow.awt.AWTGraphicsDevice; +import com.jogamp.nativewindow.awt.AWTGraphicsScreen; +import com.jogamp.nativewindow.awt.JAWTWindow; import com.jogamp.opengl.DefaultGLCapabilitiesChooser; +import com.jogamp.opengl.FBObject; import com.jogamp.opengl.GL; import com.jogamp.opengl.GL2; import com.jogamp.opengl.GLCapabilities; @@ -75,13 +81,6 @@ import com.jogamp.opengl.GLFBODrawable; import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.Threading; -import com.jogamp.common.nio.Buffers; -import com.jogamp.nativewindow.awt.AWTGraphicsConfiguration; -import com.jogamp.nativewindow.awt.AWTGraphicsDevice; -import com.jogamp.nativewindow.awt.AWTGraphicsScreen; -import com.jogamp.nativewindow.awt.JAWTWindow; -import com.jogamp.opengl.FBObject; - /** * Concrete implementation of Pipeline class for the JOGL rendering * pipeline. @@ -8309,7 +8308,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/javax/media/j3d/MasterControl.java b/src/javax/media/j3d/MasterControl.java index c63dfd9..0bf27ab 100644 --- a/src/javax/media/j3d/MasterControl.java +++ b/src/javax/media/j3d/MasterControl.java @@ -779,6 +779,22 @@ private static String getProperty(final String prop) { }); } + static int getIntegerProperty(String prop, int defaultValue) { + int value = defaultValue; + String propValue = getProperty(prop); + + if (propValue != null) { + try { + value = Integer.parseInt(propValue); + } + catch (NumberFormatException e) {} + } + if (J3dDebug.debug) + System.err.println("Java 3D: " + prop + "=" + value); + + return value; + } + static boolean getBooleanProperty(String prop, boolean defaultValue, String trueMsg, -- cgit v1.2.3