From ee3dacf913c32fbb47e7cb22c24b03fad94e5f51 Mon Sep 17 00:00:00 2001 From: Richy Z <64844585+Richy-Z@users.noreply.github.com> Date: Sat, 18 May 2024 23:09:37 +0100 Subject: [PATCH] macOS OpenGL 4.1 and semantic version number --- .../numelon/threatengl/mixin/ThreatenGLMixin.java | 15 ++++++++++++++- gradle.properties | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/com/numelon/threatengl/mixin/ThreatenGLMixin.java b/common/src/main/java/com/numelon/threatengl/mixin/ThreatenGLMixin.java index 9f9b33d..7952cda 100644 --- a/common/src/main/java/com/numelon/threatengl/mixin/ThreatenGLMixin.java +++ b/common/src/main/java/com/numelon/threatengl/mixin/ThreatenGLMixin.java @@ -17,12 +17,25 @@ public class ThreatenGLMixin { @Redirect(method = "", 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); } diff --git a/gradle.properties b/gradle.properties index fa67b59..079d632 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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