Skip to content

Commit 43b35fa

Browse files
committed
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.
1 parent 9c15bba commit 43b35fa

3 files changed

Lines changed: 27 additions & 1 deletion

File tree

Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
349d027673855ffded0bb7471a5b662a63b438bd
1+
24ec32a7f38c6126efe7030c71a237e5ec5bf742

jre_lwjgl3glfw/src/main/java/org/lwjgl/glfw/GLFW.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,32 @@ public static long glfwCreateWindow(int width, int height, CharSequence title, l
998998
win.height = mGLFWWindowHeight;
999999
win.title = title;
10001000

1001+
// Set the Open GL version for context because Forge and derivatives ask for it
1002+
// If we give them 0.0, some mods don't like it, so we base our assumptions on a per renderer basis
1003+
int glMajor = 3;
1004+
int glMinor = 3;
1005+
// These values can be found at headings_array.xml
1006+
switch (System.getenv("POJAV_RENDERER")) {
1007+
case "vulkan_zink":
1008+
if (System.getenv("POJAV_LOAD_TURNIP").equals("1")) {
1009+
System.out.println("GLFW: Turnip+Zink detected, setting GL context to 4.6");
1010+
glMajor = 4;
1011+
glMinor = 6;
1012+
}
1013+
case "opengles3_virgl":
1014+
System.out.println("GLFW: virglrenderer detected, setting GL context to 4.3");
1015+
glMajor = 4;
1016+
glMinor = 3;
1017+
case "opengles_mobileglues":
1018+
System.out.println("GLFW: MobileGlues detected, setting GL context to 4.0");
1019+
glMajor = 4;
1020+
glMinor = 0;
1021+
break;
1022+
default:
1023+
System.out.println("GLFW: "+ System.getenv("POJAV_RENDERER") + " detected, defaulting GL context to 3.3");
1024+
}
1025+
win.windowAttribs.put(GLFW_CONTEXT_VERSION_MAJOR, glMajor);
1026+
win.windowAttribs.put(GLFW_CONTEXT_VERSION_MINOR, glMinor);
10011027
mGLFWWindowMap.put(ptr, win);
10021028
mainContext = ptr;
10031029

0 commit comments

Comments
 (0)