From 11b7c9e71c239ff239ef71a2c4c48d0420f0c489 Mon Sep 17 00:00:00 2001 From: ray Date: Mon, 15 May 2023 13:15:17 +0800 Subject: [PATCH] fix system crush issue when set desktop AppSetting.setRenderer below 3.2 --- .../main/java/com/jme3/system/lwjgl/LwjglWindow.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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..670748d936 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 @@ -238,8 +238,16 @@ public void invoke(int error, long description) { final String renderer = settings.getRenderer(); - glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); - glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); + //Appsettings GL version below 3.2 + if ((!RENDER_CONFIGS. containsKey (renderer))|| //OPENGL20 + renderer.equals (AppSettings.LWJGL_OPENGL30)||renderer.equals (AppSettings.LWJGL_OPENGL31) + ) { + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); + glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_ANY_PROFILE); + }else { + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); + glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); + } RENDER_CONFIGS.computeIfAbsent(renderer, s -> () -> { glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_FALSE);