From d4579b9184c8b6099a1ec25349770bd92d409c32 Mon Sep 17 00:00:00 2001 From: Electroblob <35599699+Electroblob77@users.noreply.github.com> Date: Sun, 3 Jun 2018 12:39:25 +0100 Subject: [PATCH] Remove all calls to GlStateManager.pushAttrib() and pullAttrib() and a few other tweaks to gl calls, fixes #12, #46 and #47 --- .../electroblob/wizardry/client/GuiArcaneWorkbench.java | 4 ---- .../java/electroblob/wizardry/client/GuiSpellDisplay.java | 6 ++---- .../wizardry/client/particle/ParticleCustomTexture.java | 2 -- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/main/java/electroblob/wizardry/client/GuiArcaneWorkbench.java b/src/main/java/electroblob/wizardry/client/GuiArcaneWorkbench.java index 2dc2417e..453b71ee 100644 --- a/src/main/java/electroblob/wizardry/client/GuiArcaneWorkbench.java +++ b/src/main/java/electroblob/wizardry/client/GuiArcaneWorkbench.java @@ -80,8 +80,6 @@ public class GuiArcaneWorkbench extends GuiContainer { @Override public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY){ - GlStateManager.pushAttrib(); - GlStateManager.color(1F, 1F, 1F, 1F); Minecraft.getMinecraft().renderEngine.bindTexture(texture); @@ -152,8 +150,6 @@ public class GuiArcaneWorkbench extends GuiContainer { // Fixes the bug that caused the slot hightlight to render opaque. I don't know why it works, it just works! GlStateManager.disableBlend(); GlStateManager.enableAlpha(); - - GlStateManager.popAttrib(); } @Override diff --git a/src/main/java/electroblob/wizardry/client/GuiSpellDisplay.java b/src/main/java/electroblob/wizardry/client/GuiSpellDisplay.java index 0ee454a3..0f905882 100644 --- a/src/main/java/electroblob/wizardry/client/GuiSpellDisplay.java +++ b/src/main/java/electroblob/wizardry/client/GuiSpellDisplay.java @@ -122,8 +122,6 @@ public class GuiSpellDisplay extends Gui { }else if(event.getType() == RenderGameOverlayEvent.ElementType.HOTBAR){ - GlStateManager.pushAttrib(); - GlStateManager.enableBlend(); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.color(1, 1, 1); @@ -146,8 +144,8 @@ public class GuiSpellDisplay extends Gui { this.mc.renderEngine.bindTexture(discovered ? spell.getIcon() : Spells.none.getIcon()); WizardryUtilities.drawTexturedRect(mirror ? left + 94 : left + 2, top + 2, 0, 0, 32, 32, 32, 32); - - GlStateManager.popAttrib(); + + // Blend needs to be left enabled here because otherwise the hotbar becomes opaque } } diff --git a/src/main/java/electroblob/wizardry/client/particle/ParticleCustomTexture.java b/src/main/java/electroblob/wizardry/client/particle/ParticleCustomTexture.java index 090ea7c9..38259b1a 100644 --- a/src/main/java/electroblob/wizardry/client/particle/ParticleCustomTexture.java +++ b/src/main/java/electroblob/wizardry/client/particle/ParticleCustomTexture.java @@ -143,7 +143,6 @@ public abstract class ParticleCustomTexture extends Particle { float rotationYZ, float rotationXY, float rotationXZ){ GlStateManager.pushMatrix(); - GlStateManager.pushAttrib(); this.applyGLStateChanges(); @@ -193,7 +192,6 @@ public abstract class ParticleCustomTexture extends Particle { this.undoGLStateChanges(); - GlStateManager.popAttrib(); GlStateManager.popMatrix(); }