From c8d9764fe3acede9da74f20ecae7021fd67618a7 Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Wed, 13 Jan 2016 10:59:10 -0600 Subject: [PATCH] Read atlas size dynamically --- .../botania/client/core/handler/MiscellaneousIcons.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/vazkii/botania/client/core/handler/MiscellaneousIcons.java b/src/main/java/vazkii/botania/client/core/handler/MiscellaneousIcons.java index 74df2b1f3..18c6886cc 100644 --- a/src/main/java/vazkii/botania/client/core/handler/MiscellaneousIcons.java +++ b/src/main/java/vazkii/botania/client/core/handler/MiscellaneousIcons.java @@ -145,8 +145,10 @@ public class MiscellaneousIcons { return; Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); - int width = 1024; - int height = 1024; + int width = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); + int height = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT); + + System.out.printf("Atlas is %d wide by %d tall%n", width, height); int pixels = width * height; @@ -157,8 +159,7 @@ public class MiscellaneousIcons { GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1); GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, buffer); - //GL11.glReadPixels(0, 0, width, height, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, buffer); - + buffer.get(pixelValues); BufferedImage bufferedimage = new BufferedImage(width, height, 2);