TLHPoE Posted January 17, 2015 Share Posted January 17, 2015 Hello, I have a double (ranges from 0 to 1) that represents my alpha channel, and then I use the GL11#glColor4d method to change the alpha channel. Afterwards, my text is drawn. The problem is the translucency of the text drawn never changes. The first time it gets drawn it should be barely visible, but instead it looks like it has no alpha channel. Code: Minecraft mc = MCUtil.getMC(); ScaledResolution sr = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); int y = (sr.getScaledHeight() / 4) - (CHAR_HEIGHT * (text.size() - 1)), x = sr.getScaledWidth() / 2; GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glAlphaFunc(GL11.GL_GREATER, 0.002F); GL11.glColor4d(1D, 1D, 1D, alpha); for(String s : text) { RenderUtil.drawString(s, x - (getTextWidth(s) / 2), y, 0xFFFFFF); y += CHAR_HEIGHT; } GL11.glPopMatrix(); Edit: I switched to using bit operations to attach an alpha to the hex colors. int hexAlpha = (int) (255 * alpha) << 24, c1 = 0xFFFF00, c2 = 0x000000; c1 += hexAlpha; c2 += hexAlpha; Quote Kain Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.