Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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)

Borked.thumb.PNG.afa3d3c8fa012ceb0af734c62d59e38a.PNG                          redblur.png.fddb65a9cd01e0a0e9070f5ff62f814a.png

https://github.com/BeardlessBrady/PlayerTraits-Mod/blob/master-1.11/src/main/java/gunn/modtraits/mod/event/ClientEvents.java#L49

 

 

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.

  • Author

Fixed, Called 'GlStateManager.alphaFunc(GL11.GL_ALWAYS, 1f);' before rendering and then 'GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1f)' after

Edited 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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.