Skip to content

Commit

Permalink
macOS OpenGL 4.1 and semantic version number
Browse files Browse the repository at this point in the history
  • Loading branch information
Richy-Z committed May 18, 2024
1 parent 1b99d16 commit ee3dacf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,25 @@ public class ThreatenGLMixin {

@Redirect(method = "<init>", at = @At(value = "INVOKE", target = "Lorg/lwjgl/glfw/GLFW;glfwWindowHint(II)V", remap = false))
private void hintOverride(int hint, int value) {
// check if on macOS
String osName = System.getProperty("os.name").toLowerCase();

// Checking whether the window hint intercepted is the GLFW Context Version
if (hint == GLFW.GLFW_CONTEXT_VERSION_MAJOR) {
value = 4;
LOGGER.info("Threatened Minecraft to use GLFW_CONTEXT_VERSION_MAJOR " + value);
} else if (hint == GLFW.GLFW_CONTEXT_VERSION_MINOR) {
value = 6;
// NOTE: I am aware that macOS uses OpenGL 4.1 by default with Minecraft. This was only added so that Minecraft initialises instead of complaining about the OpenGL version, for users who are unaware of the state of OpenGL on macOS.

// OpenGL stopped receiving support since OS X Mavericks (10.9) in favour of metal of course :heart_eyes:
// if on macOS, use 4.1 instead of 4.6
if (osName.contains("mac")) {
LOGGER.info("It looks like you're on macOS, which ditched OpenGL in 2013 in favour of Metal. The maximum supported version is 4.1, so that will be used instead of 4.6.");
value = 1;
} else {
// all other OSes
value = 6;
}
LOGGER.info("Threatened Minecraft to use GLFW_CONTEXT_VERSION_MINOR " + value);
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx8G
org.gradle.parallel=true

# Mod properties
mod_version = 1.2.1-beta.3
mod_version = 1.3.0-beta.1
maven_group = com.numelon.threatengl
archives_name = threatengl
enabled_platforms = fabric,forge,neoforge,quilt
Expand Down

0 comments on commit ee3dacf

Please sign in to comment.