Created
June 15, 2012 18:23
-
-
Save SanAndreaP/2938010 to your computer and use it in GitHub Desktop.
some text rendering code for text in minecraft which shall glow in the night (on signs, entity labela a.o.)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void renderLightText(String s, int xPos, int yPos, int color, FontRenderer fontrenderer) { | |
GL11.glDepthMask(true); | |
fontrenderer.drawString(s, xPos, yPos, 0x000000); | |
this.drawString(s, xPos, yPos, color, true, fontrenderer); | |
this.drawString(s, xPos, yPos, color, false, fontrenderer); | |
} | |
protected void drawString(String s, int d, int d1, double d2, boolean blend, FontRenderer fontrenderer) { | |
byte byte0 = -1; | |
GL11.glPushMatrix(); | |
GL11.glDisable(2896 /* GL_LIGHTING */); | |
GL11.glDepthMask(false); | |
GL11.glEnable(3042 /* GL_BLEND */); | |
if (blend) { | |
GL11.glDisable(3008 /* GL_ALPHA_TEST */); | |
GL11.glBlendFunc(1, 1); | |
int j1 = 61680; | |
int k1 = j1 % 0x10000; | |
int l1 = j1 / 0x10000; | |
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, | |
k1 / 1.0F, l1 / 1.0F); | |
} else { | |
GL11.glBlendFunc(1, 771); | |
} | |
fontrenderer.drawString(s, d, d1, 0xFF000000); | |
if (blend) { | |
GL11.glEnable(3008 /* GL_ALPHA_TEST */); | |
} | |
fontrenderer.drawString(s, d, d1, 0xFF000000); | |
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); | |
GL11.glDisable(3042 /* GL_BLEND */); | |
GL11.glDepthMask(true); | |
GL11.glEnable(2896 /* GL_LIGHTING */); | |
GL11.glPopMatrix(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment