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 29573bfbf..f452e7bfb 100644 --- a/jme3-core/src/main/java/com/jme3/system/AppSettings.java +++ b/jme3-core/src/main/java/com/jme3/system/AppSettings.java @@ -237,6 +237,33 @@ public final class AppSettings extends HashMap { * @see AppSettings#setAudioRenderer(java.lang.String) */ public static final String ANDROID_OPENAL_SOFT = "OpenAL_SOFT"; + + /** + * 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_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 audio renderer. + *

+ * N.B: This backend is EXPERIMENTAL + * + * @see AppSettings#setAudioRenderer(java.lang.String) + */ + public static final String JOAL = "JOAL"; static { defaults.put("Width", 640); @@ -644,6 +671,8 @@ public final class AppSettings extends HashMap { *

  • AppSettings.LWJGL_OPENGL3 - Force OpenGL3.3 compatability
  • *
  • AppSettings.LWJGL_OPENGL_ANY - Choose an appropriate * OpenGL version based on system capabilities
  • + *
  • AppSettings.JOGL_OPENGL_BACKWARD_COMPATIBLE
  • + *
  • AppSettings.JOGL_OPENGL_FORWARD_COMPATIBLE
  • *
  • null - Disable graphics rendering
  • * * @param renderer The renderer to set @@ -667,6 +696,7 @@ public final class AppSettings extends HashMap { * Set the audio renderer to use. One of:
    * * @param audioRenderer diff --git a/jme3-desktop/src/main/java/com/jme3/system/JmeDesktopSystem.java b/jme3-desktop/src/main/java/com/jme3/system/JmeDesktopSystem.java index f5fb45af2..52658040d 100644 --- a/jme3-desktop/src/main/java/com/jme3/system/JmeDesktopSystem.java +++ b/jme3-desktop/src/main/java/com/jme3/system/JmeDesktopSystem.java @@ -221,6 +221,36 @@ public class JmeDesktopSystem extends JmeSystemDelegate { return null; } + private JmeContext newContextJogl(AppSettings settings, JmeContext.Type type) { + try { + Class ctxClazz = null; + switch (type) { + case Display: + ctxClazz = Class.forName("com.jme3.system.jogl.JoglNewtDisplay"); + break; + case Canvas: + ctxClazz = Class.forName("com.jme3.system.jogl.JoglNewtCanvas"); + break; + case OffscreenSurface: + ctxClazz = Class.forName("com.jme3.system.jogl.JoglOffscreenBuffer"); + break; + default: + throw new IllegalArgumentException("Unsupported context type " + type); + } + + return (JmeContext) ctxClazz.newInstance(); + } catch (InstantiationException ex) { + logger.log(Level.SEVERE, "Failed to create context", ex); + } catch (IllegalAccessException ex) { + logger.log(Level.SEVERE, "Failed to create context", ex); + } catch (ClassNotFoundException ex) { + logger.log(Level.SEVERE, "CRITICAL ERROR: Context class is missing!\n" + + "Make sure jme3-jogl is on the classpath.", ex); + } + + return null; + } + private JmeContext newContextCustom(AppSettings settings, JmeContext.Type type) { try { String className = settings.getRenderer().substring("CUSTOM".length()); @@ -250,6 +280,9 @@ public class JmeDesktopSystem extends JmeSystemDelegate { } else if (settings.getRenderer().startsWith("LWJGL")) { ctx = newContextLwjgl(settings, contextType); ctx.setSettings(settings); + } else if (settings.getRenderer().startsWith("JOGL")) { + ctx = newContextJogl(settings, contextType); + ctx.setSettings(settings); } else if (settings.getRenderer().startsWith("CUSTOM")) { ctx = newContextCustom(settings, contextType); ctx.setSettings(settings); @@ -267,8 +300,8 @@ public class JmeDesktopSystem extends JmeSystemDelegate { Class clazz = (Class) Class.forName(className); return clazz.newInstance(); } catch (ClassNotFoundException ex) { - logger.log(Level.SEVERE, "CRITICAL ERROR: Audio implementation class is missing!\n" - + "Make sure jme3_lwjgl-oal is on the classpath.", ex); + logger.log(Level.SEVERE, "CRITICAL ERROR: Audio implementation class " + + className + " is missing!\n", ex); } catch (IllegalAccessException ex) { logger.log(Level.SEVERE, "Failed to create context", ex); } catch (InstantiationException ex) { @@ -289,6 +322,10 @@ public class JmeDesktopSystem extends JmeSystemDelegate { al = newObject("com.jme3.audio.lwjgl.LwjglAL"); alc = newObject("com.jme3.audio.lwjgl.LwjglALC"); efx = newObject("com.jme3.audio.lwjgl.LwjglEFX"); + } else if (settings.getAudioRenderer().startsWith("JOAL")) { + al = newObject("com.jme3.audio.joal.JoalAL"); + alc = newObject("com.jme3.audio.joal.JoalALC"); + efx = newObject("com.jme3.audio.joal.JoalEFX"); } else { throw new UnsupportedOperationException( "Unrecognizable audio renderer specified: "