From 722c3cb442c7b5e751132f0a812d2fc771d304d5 Mon Sep 17 00:00:00 2001 From: Juuxel Date: Thu, 18 Jun 2020 12:15:14 +0300 Subject: Fix dirty GL scissors being used when the screen applies no other scissors --- .../java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java | 1 + .../io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java | 1 + src/main/java/io/github/cottonmc/cotton/gui/client/Scissors.java | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/main/java/io') diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java index 81ff65a..7c7d7d9 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java @@ -65,6 +65,7 @@ public class CottonClientScreen extends Screen implements TextHoverRendererScree WPanel root = description.getRootPanel(); if (root!=null) { GL11.glEnable(GL11.GL_SCISSOR_TEST); + Scissors.refreshScissors(); root.paint(matrices, left, top, mouseX-left, mouseY-top); GL11.glDisable(GL11.GL_SCISSOR_TEST); Scissors.checkStackIsEmpty(); diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java index b758a97..7ada7bd 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java @@ -224,6 +224,7 @@ public class CottonInventoryScreen extends Handl WPanel root = description.getRootPanel(); if (root!=null) { GL11.glEnable(GL11.GL_SCISSOR_TEST); + Scissors.refreshScissors(); root.paint(matrices, x, y, mouseX-x, mouseY-y); GL11.glDisable(GL11.GL_SCISSOR_TEST); Scissors.checkStackIsEmpty(); diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/Scissors.java b/src/main/java/io/github/cottonmc/cotton/gui/client/Scissors.java index a8f65c8..4998a05 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/client/Scissors.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/client/Scissors.java @@ -51,7 +51,7 @@ public final class Scissors { refreshScissors(); } - private static void refreshScissors() { + static void refreshScissors() { MinecraftClient mc = MinecraftClient.getInstance(); if (STACK.isEmpty()) { -- cgit