HACK: Temporary workaround for glColor3ub crash on macOS (#17)

glColor3ub is causing SEGFAULT on negative values, use glColor3i instead.
See https://github.com/LWJGL/lwjgl3/issues/858

This call is rarely used so performance impact should be minimal.
This commit is contained in:
Vadzim Dambrouski authored and GitHub committed 2023-02-15 17:58:19 +00:00
1 parent 49e85ce8df
commit c9bc61511e
1 file changed
+6 -1
@@ -625,8 +625,13 @@ public class GL11 {
org.lwjgl.opengl.GL11.glColor3f(red, green, blue);
}
private static final int UNSIGNED_BYTE_TO_INT_RATIO = Integer.MAX_VALUE / 255;
public static void glColor3ub(byte red, byte green, byte blue) {
org.lwjgl.opengl.GL11.glColor3ub(red, green, blue);
org.lwjgl.opengl.GL11.glColor3i(
(red & 0xff) * UNSIGNED_BYTE_TO_INT_RATIO,
(green & 0xff) * UNSIGNED_BYTE_TO_INT_RATIO,
(blue & 0xff) * UNSIGNED_BYTE_TO_INT_RATIO);
}
public static void glColor4b(byte red, byte green, byte blue, byte alpha) {