Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Gravenwitch.CinematicCombat.util;
- import java.awt.Color;
- import org.lwjgl.opengl.GL11;
- public final class OpenGLUtils {
- public static void glColor(Color color) {
- // Null‐guard: fallback to white if color is null
- if (color == null) {
- GL11.glColor4ub((byte)255, (byte)255, (byte)255, (byte)255);
- return;
- }
- GL11.glColor4ub(
- (byte) color.getRed(),
- (byte) color.getGreen(),
- (byte) color.getBlue(),
- (byte) color.getAlpha()
- );
- }
- public static void glColor(Color color, float alphaMult) {
- // Null‐guard: fallback to white if color is null
- if (color == null) {
- GL11.glColor4ub((byte)255, (byte)255, (byte)255, (byte)255);
- return;
- }
- GL11.glColor4ub(
- (byte) color.getRed(),
- (byte) color.getGreen(),
- (byte) color.getBlue(),
- (byte) ((float) color.getAlpha() * alphaMult)
- );
- }
- public static void setupRendering() {
- GL11.glPushAttrib(1048575);
- GL11.glDisable(3553);
- GL11.glEnable(2848);
- GL11.glHint(3154, 4354);
- GL11.glEnable(3042);
- GL11.glBlendFunc(770, 771);
- GL11.glTranslatef(0.01f, 0.01f, 0.0f);
- }
- public static void finishRendering() {
- GL11.glDisable(3042);
- GL11.glMatrixMode(5888);
- GL11.glPopMatrix();
- GL11.glPopAttrib();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement