Skip to content

Commit

Permalink
clamp scissor coordinates before passing to ogl in ScissorStack#apply…
Browse files Browse the repository at this point in the history
…State
  • Loading branch information
gliscowo committed Sep 14, 2024
1 parent cbc2e3c commit dc24701
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ minecraft_version=1.21
yarn_mappings=1.21+build.2
loader_version=0.15.11
# Mod Properties
mod_version=0.12.13
mod_version=0.12.14-pre.1
maven_group=io.wispforest
archives_base_name=owo-lib
# Dependencies
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/io/wispforest/owo/ui/util/ScissorStack.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ private static void applyState() {
var scale = window.getScaleFactor();

GL11.glScissor(
(int) (newFrame.x() * scale),
(int) (window.getFramebufferHeight() - (newFrame.y() * scale) - newFrame.height() * scale),
MathHelper.clamp((int) (newFrame.width() * scale), 0, window.getFramebufferWidth()),
MathHelper.clamp((int) (newFrame.height() * scale), 0, window.getFramebufferHeight())
Math.max(0, (int) (newFrame.x() * scale)),
Math.max((int) (window.getFramebufferHeight() - (newFrame.y() * scale) - newFrame.height() * scale), 0),
Math.min(MathHelper.clamp((int) (newFrame.width() * scale), 0, window.getFramebufferWidth()), window.getFramebufferWidth()),
Math.min(MathHelper.clamp((int) (newFrame.height() * scale), 0, window.getFramebufferHeight()), window.getFramebufferHeight())
);
}

Expand Down

0 comments on commit dc24701

Please sign in to comment.