diff --git a/api/src/main/java/com/seibel/distanthorizons/api/enums/config/EGlProfileMode.java b/api/src/main/java/com/seibel/distanthorizons/api/enums/config/EGlProfileMode.java new file mode 100644 index 000000000..acf2f8181 --- /dev/null +++ b/api/src/main/java/com/seibel/distanthorizons/api/enums/config/EGlProfileMode.java @@ -0,0 +1,30 @@ +/* + * This file is part of the Distant Horizons mod + * licensed under the GNU LGPL v3 License. + * + * Copyright (C) 2020-2023 James Seibel + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.seibel.distanthorizons.api.enums.config; + +/** + * @since API 1.0.0 + */ +public enum EGlProfileMode +{ + CORE, + COMPAT, + ANY; +} diff --git a/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java b/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java index 7a5e53f08..8bce0b706 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java @@ -1165,21 +1165,35 @@ public class Config + "") .build(); + // TODO temporary test, remove me public static ConfigEntry skipChunkLoadUpdates = new ConfigEntry.Builder() .set(false) .comment("") .build(); + // TODO temporary test, remove me public static ConfigEntry skipChunkUnloadUpdates = new ConfigEntry.Builder() .set(false) .comment("") .build(); + // TODO temporary test, remove me public static ConfigEntry skipFullDataUpdateQueue = new ConfigEntry.Builder() .set(false) .comment("") .build(); + // TODO temporary test, remove me + public static ConfigEntry glProfileMode = new ConfigEntry.Builder() + .set(EGlProfileMode.CORE) + .comment("") + .build(); + // TODO temporary test, remove me + public static ConfigEntry glForwardCompatibilityMode = new ConfigEntry.Builder() + .set(true) + .comment("") + .build(); + diff --git a/core/src/main/java/com/seibel/distanthorizons/core/render/glObject/GLProxy.java b/core/src/main/java/com/seibel/distanthorizons/core/render/glObject/GLProxy.java index da4d5c7fe..2403a71a3 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/render/glObject/GLProxy.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/render/glObject/GLProxy.java @@ -21,6 +21,7 @@ package com.seibel.distanthorizons.core.render.glObject; import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.seibel.distanthorizons.api.enums.config.EGLErrorHandlingMode; +import com.seibel.distanthorizons.api.enums.config.EGlProfileMode; import com.seibel.distanthorizons.api.enums.config.EGpuUploadMethod; import com.seibel.distanthorizons.core.config.Config; import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector; @@ -160,10 +161,27 @@ public class GLProxy // DO NOT comment out the following 2 lines: they are needed for mac and creating forward compatible contexts GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MAJOR, 3); GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MINOR, 2); - GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_FORWARD_COMPAT, GLFW.GLFW_TRUE); - GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_PROFILE, GLFW.GLFW_OPENGL_CORE_PROFILE); GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_DEBUG_CONTEXT, GLFW.GLFW_TRUE); + // TODO remove me + boolean useForwardCompatibility = Config.Client.Advanced.Debugging.glForwardCompatibilityMode.get(); + GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_FORWARD_COMPAT, useForwardCompatibility ? GLFW.GLFW_TRUE : GLFW.GLFW_FALSE); + + // TODO remove me + EGlProfileMode profileMode = Config.Client.Advanced.Debugging.glProfileMode.get(); + if (profileMode == EGlProfileMode.CORE) + { + GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_PROFILE, GLFW.GLFW_OPENGL_CORE_PROFILE); + } + else if (profileMode == EGlProfileMode.ANY) + { + GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_PROFILE, GLFW.GLFW_OPENGL_ANY_PROFILE); + } + else + { + GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_PROFILE, GLFW.GLFW_OPENGL_COMPAT_PROFILE); + } + // create the Lod Builder context lodBuilderGlContext = GLFW.glfwCreateWindow(64, 48, "LOD Builder Window", 0L, minecraftGlContext); if (lodBuilderGlContext == 0) diff --git a/core/src/main/resources/assets/distanthorizons/lang/en_us.json b/core/src/main/resources/assets/distanthorizons/lang/en_us.json index dbcfd896a..735675907 100644 --- a/core/src/main/resources/assets/distanthorizons/lang/en_us.json +++ b/core/src/main/resources/assets/distanthorizons/lang/en_us.json @@ -425,6 +425,14 @@ "OpenGL Error Handling Mode", "distanthorizons.config.client.advanced.debugging.glErrorHandlingMode.@tooltip": "Defines how OpenGL errors are handled. \nMay incorrectly catch OpenGL errors thrown by other mods.", + "distanthorizons.config.client.advanced.debugging.glProfileMode": + "OpenGL Profile Mode", + "distanthorizons.config.client.advanced.debugging.glProfileMode.@tooltip": + "Requires rebooting Minecraft to apply.", + "distanthorizons.config.client.advanced.debugging.glForwardCompatibilityMode": + "OpenGL Forward Compatibility Mode", + "distanthorizons.config.client.advanced.debugging.glForwardCompatibilityMode.@tooltip": + "Requires rebooting Minecraft to apply.", "distanthorizons.config.client.advanced.buffers": @@ -732,6 +740,13 @@ "distanthorizons.config.enum.EGLErrorHandlingMode.LOG_THROW": "Log-Throw", + "distanthorizons.config.enum.EGlProfileMode.CORE": + "Core", + "distanthorizons.config.enum.EGlProfileMode.COMPAT": + "Compat", + "distanthorizons.config.enum.EGlProfileMode.ANY": + "Any", + "distanthorizons.config.enum.ELoggerMode.DISABLED": "Disabled", "distanthorizons.config.enum.ELoggerMode.LOG_ALL_TO_FILE":