Add the ability to manually choose OpenGL version
This commit is contained in:
@@ -1228,30 +1228,32 @@ public class Config
|
||||
+ "")
|
||||
.build();
|
||||
|
||||
//public static ConfigEntry<Integer> glContextMajorVersion = new ConfigEntry.Builder<Integer>()
|
||||
// .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<Integer> glContextMinorVersion = new ConfigEntry.Builder<Integer>()
|
||||
// .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<Integer> glContextMajorVersion = new ConfigEntry.Builder<Integer>()
|
||||
.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<Integer> glContextMinorVersion = new ConfigEntry.Builder<Integer>()
|
||||
.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<EGlProfileMode> glProfileMode = new ConfigEntry.Builder<EGlProfileMode>()
|
||||
.set(EGlProfileMode.CORE)
|
||||
|
||||
@@ -171,7 +171,20 @@ public class GLProxy
|
||||
long potentialLodBuilderGlContext = 0;
|
||||
GLCapabilities potentialLodBuilderGlCapabilities = null;
|
||||
|
||||
for (Pair<Integer, Integer> supportedGlVersion : SUPPORTED_GL_VERSIONS)
|
||||
int majorGlVersion = Config.Client.Advanced.Debugging.OpenGl.glContextMajorVersion.get();
|
||||
int minorGlVersion = Config.Client.Advanced.Debugging.OpenGl.glContextMinorVersion.get();
|
||||
|
||||
ArrayList<Pair<Integer, Integer>> glVersions = new ArrayList<>();
|
||||
if (majorGlVersion != 0)
|
||||
{
|
||||
glVersions.add(new Pair<>(majorGlVersion, minorGlVersion));
|
||||
}
|
||||
else
|
||||
{
|
||||
glVersions.addAll(SUPPORTED_GL_VERSIONS);
|
||||
}
|
||||
|
||||
for (Pair<Integer, Integer> 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;
|
||||
|
||||
Reference in New Issue
Block a user