mirror of
https://github.com/GTNewHorizons/lwjgl3ify.git
synced 2026-11-21 12:42:15 +00:00
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:
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) {
|
||||
|
||||
Reference in new issue
Block a user