fix(GLFW): Fix forge crash GL Version 0.0

Adds a some logic so mods that use this instead of
glGetString(GL_VERSION) can get something

They really should not be using this though.
This commit is contained in:
alexytomi 2025-07-17 23:19:20 +08:00
parent 9c15bbae3f
commit 43b35fab0d
3 changed files with 27 additions and 1 deletions

View File

@ -1 +1 @@
349d027673855ffded0bb7471a5b662a63b438bd
24ec32a7f38c6126efe7030c71a237e5ec5bf742

View File

@ -998,6 +998,32 @@ public class GLFW
win.height = mGLFWWindowHeight;
win.title = title;
// Set the Open GL version for context because Forge and derivatives ask for it
// If we give them 0.0, some mods don't like it, so we base our assumptions on a per renderer basis
int glMajor = 3;
int glMinor = 3;
// These values can be found at headings_array.xml
switch (System.getenv("POJAV_RENDERER")) {
case "vulkan_zink":
if (System.getenv("POJAV_LOAD_TURNIP").equals("1")) {
System.out.println("GLFW: Turnip+Zink detected, setting GL context to 4.6");
glMajor = 4;
glMinor = 6;
}
case "opengles3_virgl":
System.out.println("GLFW: virglrenderer detected, setting GL context to 4.3");
glMajor = 4;
glMinor = 3;
case "opengles_mobileglues":
System.out.println("GLFW: MobileGlues detected, setting GL context to 4.0");
glMajor = 4;
glMinor = 0;
break;
default:
System.out.println("GLFW: "+ System.getenv("POJAV_RENDERER") + " detected, defaulting GL context to 3.3");
}
win.windowAttribs.put(GLFW_CONTEXT_VERSION_MAJOR, glMajor);
win.windowAttribs.put(GLFW_CONTEXT_VERSION_MINOR, glMinor);
mGLFWWindowMap.put(ptr, win);
mainContext = ptr;