diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-02-14 21:19:30 +0100 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-02-14 21:19:30 +0100 |
commit | 40de734a68cd83d4e1d3ab96703b57bf896bcae0 (patch) | |
tree | 5d7f9f93864eee045cd6a19e9f05837bde8a3b08 /src/main/java/io/polyfrost/oneconfig/renderer | |
parent | 752979fec2f8a902a319691a92f468f27137c16a (diff) | |
download | OneConfig-40de734a68cd83d4e1d3ab96703b57bf896bcae0.tar.gz OneConfig-40de734a68cd83d4e1d3ab96703b57bf896bcae0.tar.bz2 OneConfig-40de734a68cd83d4e1d3ab96703b57bf896bcae0.zip |
Make font renderer work
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/renderer')
-rw-r--r-- | src/main/java/io/polyfrost/oneconfig/renderer/TrueTypeFont.java | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/renderer/TrueTypeFont.java b/src/main/java/io/polyfrost/oneconfig/renderer/TrueTypeFont.java index 1ce922b..16e7556 100644 --- a/src/main/java/io/polyfrost/oneconfig/renderer/TrueTypeFont.java +++ b/src/main/java/io/polyfrost/oneconfig/renderer/TrueTypeFont.java @@ -1,5 +1,7 @@ package io.polyfrost.oneconfig.renderer; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; import org.lwjgl.BufferUtils; import org.lwjgl.opengl.GL11; import org.lwjgl.util.glu.GLU; @@ -262,14 +264,18 @@ public class TrueTypeFont { float RenderWidth = (SrcWidth / textureWidth); float RenderHeight = (SrcHeight / textureHeight); - GL11.glTexCoord2f(TextureSrcX, TextureSrcY); - GL11.glVertex2f(drawX, drawY); - GL11.glTexCoord2f(TextureSrcX, TextureSrcY + RenderHeight); - GL11.glVertex2f(drawX, drawY + DrawHeight); - GL11.glTexCoord2f(TextureSrcX + RenderWidth, TextureSrcY + RenderHeight); - GL11.glVertex2f(drawX + DrawWidth, drawY + DrawHeight); - GL11.glTexCoord2f(TextureSrcX + RenderWidth, TextureSrcY); - GL11.glVertex2f(drawX + DrawWidth, drawY); + GlStateManager.bindTexture(fontTextureID); + + GL11.glBegin(GL11.GL_TRIANGLE_STRIP); + GL11.glTexCoord2f(TextureSrcX + RenderWidth, TextureSrcY); // 2 + GL11.glVertex2f(drawX + DrawWidth, drawY + DrawHeight); // 1 + GL11.glTexCoord2f(TextureSrcX, TextureSrcY); // 1 + GL11.glVertex2f(drawX, drawY + DrawHeight); // 2 + GL11.glTexCoord2f(TextureSrcX + RenderWidth, TextureSrcY + RenderHeight); // 4 + GL11.glVertex2f(drawX + DrawWidth, drawY); // 3 + GL11.glTexCoord2f(TextureSrcX, TextureSrcY + RenderHeight); // 3 + GL11.glVertex2f(drawX, drawY); // 4 + GL11.glEnd(); } public int getWidth(String whatchars) { @@ -362,9 +368,7 @@ public class TrueTypeFont { } - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glBindTexture(GL11.GL_TEXTURE_2D, fontTextureID); - GL11.glBegin(GL11.GL_QUADS); + //GlStateManager.enableTexture2D(); while (i >= startIndex && i <= endIndex) { @@ -406,8 +410,7 @@ public class TrueTypeFont { } } - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glEnd(); + //GlStateManager.disableTexture2D(); } public static int loadImage(BufferedImage bufferedImage) { |