aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java48
1 files changed, 30 insertions, 18 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
index 5966e9b..0a9ccce 100644
--- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
+++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
@@ -1,20 +1,21 @@
package cc.polyfrost.oneconfig.lwjgl;
import cc.polyfrost.oneconfig.config.OneConfigConfig;
-import cc.polyfrost.oneconfig.lwjgl.font.Font;
import cc.polyfrost.oneconfig.lwjgl.font.FontManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
import cc.polyfrost.oneconfig.lwjgl.image.Image;
import cc.polyfrost.oneconfig.lwjgl.image.ImageLoader;
import cc.polyfrost.oneconfig.lwjgl.image.Images;
import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
-import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.shader.Framebuffer;
import org.lwjgl.nanovg.NVGColor;
import org.lwjgl.nanovg.NVGPaint;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL14;
import java.awt.*;
import java.util.function.LongConsumer;
@@ -63,7 +64,7 @@ public final class RenderManager {
nvgEndFrame(vg);
- GlStateManager.popAttrib();
+ GL11.glPopAttrib();
}
public static void drawRectangle(long vg, float x, float y, float width, float height, int color) { // TODO make everything use this one day
@@ -309,10 +310,10 @@ public final class RenderManager {
}
public static void drawScaledString(String text, float x, float y, int color, boolean shadow, float scale) {
- GlStateManager.pushMatrix();
- GlStateManager.scale(scale, scale, 1);
+ GL11.glPushMatrix();
+ GL11.glScalef(scale, scale, 1);
Minecraft.getMinecraft().fontRendererObj.drawString(text, x * (1 / scale), y * (1 / scale), color, shadow);
- GlStateManager.popMatrix();
+ GL11.glPopMatrix();
}
public static void glColor(int color) {
@@ -320,29 +321,40 @@ public final class RenderManager {
float f1 = (float) (color >> 16 & 255) / 255.0F;
float f2 = (float) (color >> 8 & 255) / 255.0F;
float f3 = (float) (color & 255) / 255.0F;
- GlStateManager.color(f1, f2, f3, f);
+ GL11.glColor4f(f1, f2, f3, f);
}
public static void drawDottedLine(float sx, float sy, float ex, float ey, int width, int factor, int color) {
- GlStateManager.pushMatrix();
+ GL11.glPushMatrix();
GL11.glLineStipple(factor, (short) 0xAAAA);
GL11.glEnable(GL11.GL_LINE_STIPPLE);
- GlStateManager.pushMatrix();
- GlStateManager.disableTexture2D();
- GlStateManager.enableBlend();
- GlStateManager.disableAlpha();
- GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_TEXTURE_2D);
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glDisable(GL11.GL_ALPHA);
+ GL14.glBlendFuncSeparate(770, 771, 1, 0); // this should never fail because it's a GL14 call, and we import GL31
glColor(color);
GL11.glLineWidth(width);
GL11.glBegin(GL11.GL_LINES);
GL11.glVertex2d(sx, sy);
GL11.glVertex2d(ex, ey);
GL11.glEnd();
- GlStateManager.disableBlend();
- GlStateManager.enableAlpha();
- GlStateManager.enableTexture2D();
- GlStateManager.popMatrix();
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glEnable(GL11.GL_ALPHA);
+ GL11.glEnable(GL11.GL_TEXTURE_2D);
+ GL11.glPopMatrix();
GL11.glDisable(GL11.GL_LINE_STIPPLE);
- GlStateManager.popMatrix();
+ GL11.glPopMatrix();
+ }
+
+ public static void drawGlRect(int x, int y, int width, int height, int color) {
+ Gui.drawRect(x, y, x + width, y + height, color);
+ }
+
+
+
+ // other minecraft functions
+ public static void displayGuiScreen(GuiScreen guiScreen) {
+ Minecraft.getMinecraft().displayGuiScreen(guiScreen);
}
}