Posted March 13, 20178 yr Trying to draw a red fading overlay but it just ends up weird. I tried messing around with OpenGL blend but I can't get it right, any ideas? (How it shows in game Vs. How it should look) https://github.com/BeardlessBrady/PlayerTraits-Mod/blob/master-1.11/src/main/java/gunn/modtraits/mod/event/ClientEvents.java#L49
March 13, 20178 yr It appears the image's alpha is being raised to 1 above a certain threshold. Taking a look at the pumpkin blur code in net.minecraft.client.gui.GuiIngame, the major difference in yours versus the pumpkin (which appears to have functional alpha transparencies from the image), is that "depth" and "alpha" are being disabled, and the depth mask flag is set to false before drawing the image. It also appears to be using the blend function differently. Here's what I'm referring to: protected void renderPumpkinOverlay(ScaledResolution scaledRes) { // this stuff is what's different. GlStateManager.disableDepth(); GlStateManager.depthMask(false); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableAlpha(); // the draw code looks like yours. this.mc.getTextureManager().bindTexture(PUMPKIN_BLUR_TEX_PATH); Tessellator tessellator = Tessellator.getInstance(); // .. tessellator.draw(); // re-enable the things you disabled. GlStateManager.depthMask(true); GlStateManager.enableDepth(); GlStateManager.enableAlpha(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); } Try adding in those calls and see if that makes a difference. I know the pumpkin blur does something similar but on a smaller scale, so this may solve the issue.
March 17, 20178 yr Author Fixed, Called 'GlStateManager.alphaFunc(GL11.GL_ALWAYS, 1f);' before rendering and then 'GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1f)' after Edited March 17, 20178 yr by BeardlessBrady
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.