aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisXander <xander@isxander.dev>2023-08-16 09:10:49 +0100
committerisXander <xander@isxander.dev>2023-08-16 09:10:49 +0100
commitb3d5164010682cdf2d3f68be141792bf71a5dd49 (patch)
tree80c32a22084e144fbfdb13cbe67e9d9ab6f88efa
parenta892b7e9c2f67b072cf1461241f4ba5488e41370 (diff)
downloadYetAnotherConfigLib-b3d5164010682cdf2d3f68be141792bf71a5dd49.tar.gz
YetAnotherConfigLib-b3d5164010682cdf2d3f68be141792bf71a5dd49.tar.bz2
YetAnotherConfigLib-b3d5164010682cdf2d3f68be141792bf71a5dd49.zip
Seem to resolve GL error when loading images
-rw-r--r--common/src/main/java/dev/isxander/yacl3/gui/ImageRenderer.java6
-rw-r--r--test-common/src/main/java/dev/isxander/yacl3/test/GuiTest.java2
-rw-r--r--test-common/src/main/resources/assets/yacl3/reach-around-placement.webpbin0 -> 14840 bytes
3 files changed, 2 insertions, 6 deletions
diff --git a/common/src/main/java/dev/isxander/yacl3/gui/ImageRenderer.java b/common/src/main/java/dev/isxander/yacl3/gui/ImageRenderer.java
index 717adaa..9617c58 100644
--- a/common/src/main/java/dev/isxander/yacl3/gui/ImageRenderer.java
+++ b/common/src/main/java/dev/isxander/yacl3/gui/ImageRenderer.java
@@ -279,7 +279,7 @@ public interface ImageRenderer {
int cols = (int)Math.ceil(Math.sqrt(frameCount) / Math.sqrt(ratio));
int rows = (int)Math.ceil(frameCount / (double)cols);
- NativeImage image = new NativeImage(NativeImage.Format.RGBA, frameWidth * cols, frameHeight * rows, true);
+ NativeImage image = new NativeImage(NativeImage.Format.RGBA, frameWidth * cols, frameHeight * rows, false);
// // Fill whole atlas with black, as each frame may have different dimensions
// // that would cause borders of transparent pixels to appear around the frames
@@ -335,10 +335,6 @@ public interface ImageRenderer {
}
}
}
- // gives the texture to GL for rendering
- // usually, you create a native image with NativeImage.create, which sets the pixels and
- // runs this function itself. In this case, we need to do it manually.
- image.upload(0, 0, 0, false);
if (graphics != null)
graphics.dispose();
diff --git a/test-common/src/main/java/dev/isxander/yacl3/test/GuiTest.java b/test-common/src/main/java/dev/isxander/yacl3/test/GuiTest.java
index 9c232ca..71b57f0 100644
--- a/test-common/src/main/java/dev/isxander/yacl3/test/GuiTest.java
+++ b/test-common/src/main/java/dev/isxander/yacl3/test/GuiTest.java
@@ -83,7 +83,7 @@ public class GuiTest {
.append(Component.literal("e").withStyle(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("e")))))
.withStyle(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://isxander.dev")))
)
- .webpImage(Path.of("D:\\Xander\\Code\\isXander\\Controlify\\src\\main\\resources\\assets\\controlify\\textures\\screenshots\\reach-around-placement.webp"), new ResourceLocation("yacl", "e.webp"))
+ .webpImage(new ResourceLocation("yacl3", "reach-around-placement.webp"))
.build())
.binding(
defaults.booleanToggle,
diff --git a/test-common/src/main/resources/assets/yacl3/reach-around-placement.webp b/test-common/src/main/resources/assets/yacl3/reach-around-placement.webp
new file mode 100644
index 0000000..1937809
--- /dev/null
+++ b/test-common/src/main/resources/assets/yacl3/reach-around-placement.webp
Binary files differ