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 a3edea52d..cb8cf1fd7 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 @@ -1228,30 +1228,32 @@ public class Config + "") .build(); - //public static ConfigEntry glContextMajorVersion = new ConfigEntry.Builder() - // .setMinDefaultMax(3, 3, 4) - // .comment("" + - // "Can be changed if you experience crashing when loading into a world.\n" + - // "Note: setting to an invalid version may also cause the game to crash.\n" + - // "\n" + - // "Defines the requested OpenGL context major version Distant Horizons will create. \n" + - // "Possible values (DH requires 3.2 or higher at minimum): \n" + - // "4.6, 4.5, 4.4, 4.3, 4.2, 4.1, 4.0 \n" + - // "3.3, 3.2 \n" + - // "") - // .build(); - //public static ConfigEntry glContextMinorVersion = new ConfigEntry.Builder() - // .setMinDefaultMax(0, 2, 6) - // .comment("" + - // "Can be changed if you experience crashing when loading into a world.\n" + - // "Note: setting to an invalid version may also cause the game to crash.\n" + - // "\n" + - // "Defines the requested OpenGL context major version Distant Horizons will create. \n" + - // "Possible values (DH requires 3.2 or higher at minimum): \n" + - // "4.6, 4.5, 4.4, 4.3, 4.2, 4.1, 4.0 \n" + - // "3.3, 3.2 \n" + - // "") - // .build(); + public static ConfigEntry glContextMajorVersion = new ConfigEntry.Builder() + .setMinDefaultMax(0, 0, 4) + .comment("" + + "Can be changed if you experience crashing when loading into a world.\n" + + "Note: setting to an invalid version may also cause the game to crash.\n" + + "\n" + + "Leaving this value at causes DH to try all supported GL versions. \n" + + "\n" + + "Defines the requested OpenGL context major version Distant Horizons will create. \n" + + "Possible values (DH requires 3.2 or higher at minimum): \n" + + "4.6, 4.5, 4.4, 4.3, 4.2, 4.1, 4.0 \n" + + "3.3, 3.2 \n" + + "") + .build(); + public static ConfigEntry glContextMinorVersion = new ConfigEntry.Builder() + .setMinDefaultMax(0, 0, 6) + .comment("" + + "Can be changed if you experience crashing when loading into a world.\n" + + "Note: setting to an invalid version may also cause the game to crash.\n" + + "\n" + + "Defines the requested OpenGL context major version Distant Horizons will create. \n" + + "Possible values (DH requires 3.2 or higher at minimum): \n" + + "4.6, 4.5, 4.4, 4.3, 4.2, 4.1, 4.0 \n" + + "3.3, 3.2 \n" + + "") + .build(); public static ConfigEntry glProfileMode = new ConfigEntry.Builder() .set(EGlProfileMode.CORE) 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 4d528dd84..4373120e8 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 @@ -171,7 +171,20 @@ public class GLProxy long potentialLodBuilderGlContext = 0; GLCapabilities potentialLodBuilderGlCapabilities = null; - for (Pair supportedGlVersion : SUPPORTED_GL_VERSIONS) + int majorGlVersion = Config.Client.Advanced.Debugging.OpenGl.glContextMajorVersion.get(); + int minorGlVersion = Config.Client.Advanced.Debugging.OpenGl.glContextMinorVersion.get(); + + ArrayList> glVersions = new ArrayList<>(); + if (majorGlVersion != 0) + { + glVersions.add(new Pair<>(majorGlVersion, minorGlVersion)); + } + else + { + glVersions.addAll(SUPPORTED_GL_VERSIONS); + } + + for (Pair supportedGlVersion : glVersions) { int glMajorVersion = supportedGlVersion.first; int glMinorVersion = supportedGlVersion.second; @@ -193,8 +206,8 @@ public class GLProxy GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MAJOR, glMajorVersion); GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MINOR, glMinorVersion); GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_DEBUG_CONTEXT, debugContextEnabled ? GLFW.GLFW_TRUE : GLFW.GLFW_FALSE); - GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_FORWARD_COMPAT, forwardCompatEnabled ? GLFW.GLFW_TRUE : GLFW.GLFW_FALSE); + GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_FORWARD_COMPAT, forwardCompatEnabled ? GLFW.GLFW_TRUE : GLFW.GLFW_FALSE); int profileModeInt; EGlProfileMode profileModeEnum = Config.Client.Advanced.Debugging.OpenGl.glProfileMode.get(); switch (profileModeEnum) @@ -215,15 +228,15 @@ public class GLProxy contextCreateErrorMessage = "Failed to create OpenGL GLFW context for OpenGL Version: [" + glMajorVersion + "." + glMinorVersion + "] \n" + "with Debugging: [" + (debugContextEnabled ? "Enabled" : "Disabled") + "], \n" + - "Forward Compatibility: [" + (forwardCompatEnabled ? "Enabled" : "Disabled") + "], \n" + + "Forward Compatibility: [" + (true ? "Enabled" : "Disabled") + "], \n" + "and Profile: [" + profileModeEnum.name() + "]. "; // try creating the Lod Builder context - potentialLodBuilderGlContext = GLFW.glfwCreateWindow(1, 1, "LOD Builder Window", 0L, this.minecraftGlContext); + potentialLodBuilderGlContext = GLFW.glfwCreateWindow(64, 64, "LOD Builder Window", 0L, this.minecraftGlContext); if (potentialLodBuilderGlContext == 0) { - GL_LOGGER.debug(contextCreateErrorMessage); + GL_LOGGER.info(contextCreateErrorMessage); GL_LOGGER.debug("Minecraft GL Capabilities:\n [\n" + ReflectionUtil.getAllFieldValuesAsString(this.minecraftGlCapabilities) + "\n]\n"); continue;