diff --git a/jme3-core/src/main/java/com/jme3/system/AppSettings.java b/jme3-core/src/main/java/com/jme3/system/AppSettings.java index c98845e41..2d7071c9c 100644 --- a/jme3-core/src/main/java/com/jme3/system/AppSettings.java +++ b/jme3-core/src/main/java/com/jme3/system/AppSettings.java @@ -112,13 +112,22 @@ public final class AppSettings extends HashMap { public static final String ANDROID_OPENAL_SOFT = "OpenAL_SOFT"; /** - * Use JogAmp's JOGL as the display system + * Use JogAmp's JOGL as the display system, with the OpenGL forward compatible profile *

* N.B: This backend is EXPERIMENTAL * * @see AppSettings#setRenderer(java.lang.String) */ - public static final String JOGL = "JOGL"; + public static final String JOGL_OPENGL_FORWARD_COMPATIBLE = "JOGL_OPENGL_FORWARD_COMPATIBLE"; + + /** + * Use JogAmp's JOGL as the display system with the backward compatible profile + *

+ * N.B: This backend is EXPERIMENTAL + * + * @see AppSettings#setRenderer(java.lang.String) + */ + public static final String JOGL_OPENGL_BACKWARD_COMPATIBLE = "JOGL_OPENGL_BACKWARD_COMPATIBLE"; /** * Use JogAmp's JOAL as the display system diff --git a/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglAbstractDisplay.java b/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglAbstractDisplay.java index 7b3f2e655..3b468f1aa 100644 --- a/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglAbstractDisplay.java +++ b/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglAbstractDisplay.java @@ -37,6 +37,7 @@ import com.jme3.input.MouseInput; import com.jme3.input.TouchInput; import com.jme3.input.awt.AwtKeyInput; import com.jme3.input.awt.AwtMouseInput; +import com.jme3.system.AppSettings; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.AnimatorBase; import com.jogamp.opengl.util.FPSAnimator; @@ -80,9 +81,13 @@ public abstract class JoglAbstractDisplay extends JoglContext implements GLEvent device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); - //FIXME use the settings to know whether to use the max programmable profile - //then call GLProfile.getMaxProgrammable(true); - GLCapabilities caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true)); + GLCapabilities caps; + if (settings.getRenderer().equals(AppSettings.JOGL_OPENGL_FORWARD_COMPATIBLE)) { + caps = new GLCapabilities(GLProfile.getMaxProgrammable(true)); + } else { + caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true)); + } + caps.setHardwareAccelerated(true); caps.setDoubleBuffered(true); caps.setStencilBits(settings.getStencilBits()); diff --git a/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglContext.java b/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglContext.java index 25ad4fc8e..497fa8edb 100644 --- a/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglContext.java +++ b/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglContext.java @@ -167,7 +167,7 @@ public abstract class JoglContext implements JmeContext { "required for jMonkeyEngine"); } - if (settings.getRenderer().equals("JOGL")) { + if (settings.getRenderer().startsWith("JOGL")) { com.jme3.renderer.opengl.GL gl = new JoglGL(); GLExt glext = new JoglGLExt(); GLFbo glfbo = new JoglGLFbo(); diff --git a/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglNewtAbstractDisplay.java b/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglNewtAbstractDisplay.java index 4ac6f5c49..9c7a49d17 100644 --- a/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglNewtAbstractDisplay.java +++ b/jme3-jogl/src/main/java/com/jme3/system/jogl/JoglNewtAbstractDisplay.java @@ -37,6 +37,7 @@ import com.jme3.input.MouseInput; import com.jme3.input.TouchInput; import com.jme3.input.jogl.NewtKeyInput; import com.jme3.input.jogl.NewtMouseInput; +import com.jme3.system.AppSettings; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.AnimatorBase; @@ -73,10 +74,12 @@ public abstract class JoglNewtAbstractDisplay extends JoglContext implements GLE protected void initGLCanvas() { loadNatives(); - //FIXME use the settings to know whether to use the max programmable profile - //then call GLProfile.getMaxProgrammable(true); - //FIXME use the default profile only on embedded devices - GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); + GLCapabilities caps; + if (settings.getRenderer().equals(AppSettings.JOGL_OPENGL_FORWARD_COMPATIBLE)) { + caps = new GLCapabilities(GLProfile.getMaxProgrammable(true)); + } else { + caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true)); + } caps.setHardwareAccelerated(true); caps.setDoubleBuffered(true); caps.setStencilBits(settings.getStencilBits());