diff --git a/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreen.java b/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreen.java index a02bc1cca..0a7d55628 100644 --- a/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreen.java +++ b/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreen.java @@ -44,7 +44,7 @@ public class ConfigScreen extends NavigatableSimiScreen { @Override public void renderBackground(@Nonnull MatrixStack ms) { - fill(ms, 0, 0, this.width, this.height, 0xe8_101010); + //fill(ms, 0, 0, this.width, this.height, 0xe8_101010); net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.BackgroundDrawnEvent(this, ms)); } @@ -57,7 +57,22 @@ public class ConfigScreen extends NavigatableSimiScreen { fill(ms, 0, 0, this.width, this.height, 0xff_282c34); } + /*ms.push(); + ms.translate(width*0.5f, height*0.5f, 0); renderCog(ms, partialTicks); + ms.pop();*/ + + new StencilElement() { + @Override + protected void renderStencil(MatrixStack ms) { + renderCog(ms, partialTicks); + } + + @Override + protected void renderElement(MatrixStack ms) { + fill(ms, -200, -200, 200, 200, 0x40_000000); + } + }.at(width * 0.5f, height * 0.5f, 0).render(ms); super.renderWindowBackground(ms, mouseX, mouseY, partialTicks); @@ -66,7 +81,7 @@ public class ConfigScreen extends NavigatableSimiScreen { protected void renderCog(MatrixStack ms, float partialTicks) { ms.push(); - ms.translate(.5 * width - 100, .5 * height + 110, -200); + ms.translate(-100, 100, -200); ms.scale(200, 200, .1f); GuiGameElement.of(cogwheelState) .rotateBlock(22.5, cogSpin.getValue(partialTicks), 22.5) diff --git a/src/main/java/com/simibubi/create/foundation/gui/StencilElement.java b/src/main/java/com/simibubi/create/foundation/gui/StencilElement.java index 814ab2ff3..161de3618 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/StencilElement.java +++ b/src/main/java/com/simibubi/create/foundation/gui/StencilElement.java @@ -1,5 +1,7 @@ package com.simibubi.create.foundation.gui; +import net.minecraft.client.Minecraft; + import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GlStateManager; @@ -36,11 +38,13 @@ public abstract class StencilElement { } protected void prepareStencil(MatrixStack ms) { + GL11.glDisable(GL11.GL_STENCIL_TEST); + RenderSystem.stencilMask(~0); + RenderSystem.clear(GL11.GL_STENCIL_BUFFER_BIT, Minecraft.IS_RUNNING_ON_MAC); GL11.glEnable(GL11.GL_STENCIL_TEST); - RenderSystem.clearStencil(0); - RenderSystem.stencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_REPLACE); + RenderSystem.stencilOp(GL11.GL_REPLACE, GL11.GL_KEEP, GL11.GL_KEEP); RenderSystem.stencilMask(0xFF); - RenderSystem.stencilFunc(GL11.GL_ALWAYS, 1, 0xFF); + RenderSystem.stencilFunc(GL11.GL_NEVER, 1, 0xFF); } protected void prepareElement(MatrixStack ms) {