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 cab197ce8..bd8db3107 100644 --- a/jme3-core/src/main/java/com/jme3/system/AppSettings.java +++ b/jme3-core/src/main/java/com/jme3/system/AppSettings.java @@ -70,6 +70,19 @@ public final class AppSettings extends HashMap { */ public static final String LWJGL_OPENGL2 = "LWJGL-OpenGL2"; + /** + * Use LWJGL as the display system and force using the core OpenGL3.0 renderer. + *

+ * If the underlying system does not support OpenGL3.0, then the context + * initialization will throw an exception. Note that currently jMonkeyEngine + * does not have any shaders that support OpenGL3.0 therefore this + * option is not useful. + *

+ * + * @see AppSettings#setRenderer(java.lang.String) + */ + public static final String LWJGL_OPENGL30 = "LWJGL-OpenGL30"; + /** * Use LWJGL as the display system and force using the core OpenGL3.2 renderer. *

@@ -80,10 +93,26 @@ public final class AppSettings extends HashMap { *

* Note: OpenGL 3.2 is used to give 3.x support to Mac users. * + * @deprecated Previously meant 3.2, use LWJGL_OPENGL32 or LWJGL_OPENGL30 * @see AppSettings#setRenderer(java.lang.String) */ + @Deprecated public static final String LWJGL_OPENGL3 = "LWJGL-OpenGL3"; + /** + * Use LWJGL as the display system and force using the core OpenGL3.2 renderer. + *

+ * If the underlying system does not support OpenGL3.2, then the context + * initialization will throw an exception. Note that currently jMonkeyEngine + * does not have any shaders that support OpenGL3.2 therefore this + * option is not useful. + *

+ * Note: OpenGL 3.2 is used to give 3.x support to Mac users. + * + * @see AppSettings#setRenderer(java.lang.String) + */ + public static final String LWJGL_OPENGL32 = LWJGL_OPENGL3; + /** * Use LWJGL as the display system and force using the OpenGL3.3 renderer. *

@@ -100,10 +129,22 @@ public final class AppSettings extends HashMap { * If the underlying system does not support OpenGL4.0, then the context * initialization will throw an exception. * + * @deprecated Use LWJGL_OPENGL40 * @see AppSettings#setRenderer(java.lang.String) */ + @Deprecated public static final String LWJGL_OPENGL4 = "LWJGL-OpenGL4"; + /** + * Use LWJGL as the display system and force using the OpenGL4.0 renderer. + *

+ * If the underlying system does not support OpenGL4.0, then the context + * initialization will throw an exception. + * + * @see AppSettings#setRenderer(java.lang.String) + */ + public static final String LWJGL_OPENGL40 = LWJGL_OPENGL4; + /** * Use LWJGL as the display system and force using the OpenGL4.1 renderer. *

diff --git a/jme3-desktop/src/main/java/com/jme3/system/AWTContext.java b/jme3-desktop/src/main/java/com/jme3/system/AWTContext.java index 78cde8f74..d72ee71c8 100644 --- a/jme3-desktop/src/main/java/com/jme3/system/AWTContext.java +++ b/jme3-desktop/src/main/java/com/jme3/system/AWTContext.java @@ -126,7 +126,7 @@ public class AWTContext implements JmeContext { */ protected AppSettings createSettings() { final AppSettings settings = new AppSettings(true); - settings.setRenderer(AppSettings.LWJGL_OPENGL3); + settings.setRenderer(AppSettings.LWJGL_OPENGL32); return settings; } @@ -145,7 +145,7 @@ public class AWTContext implements JmeContext { @Override public void setSettings(AppSettings settings) { this.settings.copyFrom(settings); - this.settings.setRenderer(AppSettings.LWJGL_OPENGL3); + this.settings.setRenderer(AppSettings.LWJGL_OPENGL32); this.backgroundContext.setSettings(settings); } diff --git a/jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglContext.java b/jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglContext.java index 624ad3e02..4d2d776c5 100644 --- a/jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglContext.java +++ b/jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglContext.java @@ -113,12 +113,11 @@ public abstract class LwjglContext implements JmeContext { maj = 2; min = 0; break; - // case AppSettings.LWJGL_OPENGL30: - // maj=3; - // min=0; - // break; - case AppSettings.LWJGL_OPENGL3: - // case AppSettings.LWJGL_OPENGL32: + case AppSettings.LWJGL_OPENGL30: + maj = 3; + min = 0; + break; + case AppSettings.LWJGL_OPENGL32: maj = 3; min = 2; break; @@ -126,8 +125,7 @@ public abstract class LwjglContext implements JmeContext { maj = 3; min = 3; break; - case AppSettings.LWJGL_OPENGL4: - // case AppSettings.LWJGL_OPENGL40: + case AppSettings.LWJGL_OPENGL40: maj = 4; min = 0; break; diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java index a34ce795f..8f3afca85 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java @@ -105,9 +105,10 @@ public abstract class LwjglContext implements JmeContext { private static final Set SUPPORTED_RENDERS = new HashSet<>(Arrays.asList( AppSettings.LWJGL_OPENGL2, - AppSettings.LWJGL_OPENGL3, + AppSettings.LWJGL_OPENGL30, + AppSettings.LWJGL_OPENGL32, AppSettings.LWJGL_OPENGL33, - AppSettings.LWJGL_OPENGL4, + AppSettings.LWJGL_OPENGL40, AppSettings.LWJGL_OPENGL41, AppSettings.LWJGL_OPENGL42, AppSettings.LWJGL_OPENGL43, diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java index a5d8254db..e84c5c3ce 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java @@ -76,7 +76,11 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable { private static final Map RENDER_CONFIGS = new HashMap<>(); static { - RENDER_CONFIGS.put(AppSettings.LWJGL_OPENGL3, () -> { + RENDER_CONFIGS.put(AppSettings.LWJGL_OPENGL30, () -> { + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); + }); + RENDER_CONFIGS.put(AppSettings.LWJGL_OPENGL32, () -> { glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); }); @@ -84,7 +88,7 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable { glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); }); - RENDER_CONFIGS.put(AppSettings.LWJGL_OPENGL4, () -> { + RENDER_CONFIGS.put(AppSettings.LWJGL_OPENGL40, () -> { glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); }); diff --git a/jme3-vr/src/main/java/com/jme3/app/VRApplication.java b/jme3-vr/src/main/java/com/jme3/app/VRApplication.java index 0ea29d645..c81d9b882 100644 --- a/jme3-vr/src/main/java/com/jme3/app/VRApplication.java +++ b/jme3-vr/src/main/java/com/jme3/app/VRApplication.java @@ -763,8 +763,8 @@ public abstract class VRApplication implements Application, SystemListener { // set opengl mode if( tryOpenGL3 ) { - logger.config("Using LWJGL OpenGL 3 renderer."); - settings.setRenderer(AppSettings.LWJGL_OPENGL3); + logger.config("Using LWJGL OpenGL 3.2 renderer."); + settings.setRenderer(AppSettings.LWJGL_OPENGL32); } else { logger.config("Using LWJGL OpenGL 2 renderer."); settings.setRenderer(AppSettings.LWJGL_OPENGL2); diff --git a/jme3-vr/src/main/java/com/jme3/system/lwjgl/LwjglContextVR.java b/jme3-vr/src/main/java/com/jme3/system/lwjgl/LwjglContextVR.java index dfe19e906..1c461e6f3 100644 --- a/jme3-vr/src/main/java/com/jme3/system/lwjgl/LwjglContextVR.java +++ b/jme3-vr/src/main/java/com/jme3/system/lwjgl/LwjglContextVR.java @@ -147,14 +147,14 @@ public abstract class LwjglContextVR implements JmeContext { } protected void initContextFirstTime() { - final GLCapabilities capabilities = createCapabilities(settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3)); + final GLCapabilities capabilities = createCapabilities(settings.getRenderer().equals(AppSettings.LWJGL_OPENGL32)); if (!capabilities.OpenGL20) { throw new RendererException("OpenGL 2.0 or higher is required for jMonkeyEngine"); } if (settings.getRenderer().equals(AppSettings.LWJGL_OPENGL2) - || settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3)) { + || settings.getRenderer().equals(AppSettings.LWJGL_OPENGL32)) { GL gl = new LwjglGL(); GLExt glext = new LwjglGLExt(); GLFbo glfbo;