From 0b26dc228bfefb4cdbcd4ad4b499aa4efafc3233 Mon Sep 17 00:00:00 2001 From: Raymond Young Date: Tue, 16 May 2023 01:18:47 +0800 Subject: [PATCH] solve issue #2011 (app crashes when using OpenGL version 3.0 and 3.1 with LWJGL 3) (#2009) * fix system crush issue when set desktop AppSetting.setRenderer below 3.2 * Revert "fix system crush issue when set desktop AppSetting.setRenderer below 3.2" This reverts commit 11b7c9e71c239ff239ef71a2c4c48d0420f0c489. * fix system crush issue when set desktop AppSetting.setRenderer below 3.2. This fix is reedited by instruction of ali_rs --------- Co-authored-by: ray --- .../src/main/java/com/jme3/system/lwjgl/LwjglWindow.java | 6 ++++++ 1 file changed, 6 insertions(+) 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 1647540ffb..c2b5e47402 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 @@ -87,10 +87,16 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable { static { RENDER_CONFIGS.put(AppSettings.LWJGL_OPENGL30, () -> { + // Based on GLFW docs for OpenGL version below 3.2, + // GLFW_OPENGL_ANY_PROFILE must be used. + glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_ANY_PROFILE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); }); RENDER_CONFIGS.put(AppSettings.LWJGL_OPENGL31, () -> { + // Based on GLFW docs for OpenGL version below 3.2, + // GLFW_OPENGL_ANY_PROFILE must be used. + glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_ANY_PROFILE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); });