From f76bb5c85dac39388add2d8cd61de969f1e66d9e Mon Sep 17 00:00:00 2001 From: Gwani Date: Sat, 7 Feb 2015 13:28:43 +0100 Subject: [PATCH] Added glPushMatrix/glPopMatrix-pair to LightningHandler. LightningHandler.onRenderWorldLast() modifies the model/view matrix and should therefore save and restore it. Actually, it introduces round-off errors into the model/view matrix by translating to world coordinates and back (calls to GL11.glTranslated()) which are proportional to the world coordinates' values (distant coordinates like 29 million introduce quite significant errors). Not restoring the matrix therefore makes it hard for other mods to do rendering correctly at distant coordinates. --- .../vazkii/botania/client/core/handler/LightningHandler.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/vazkii/botania/client/core/handler/LightningHandler.java b/src/main/java/vazkii/botania/client/core/handler/LightningHandler.java index bb5df9238..423503441 100644 --- a/src/main/java/vazkii/botania/client/core/handler/LightningHandler.java +++ b/src/main/java/vazkii/botania/client/core/handler/LightningHandler.java @@ -74,6 +74,7 @@ public class LightningHandler { interpPosY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * frame; interpPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * frame; + GL11.glPushMatrix(); GL11.glTranslated(-interpPosX, -interpPosY, -interpPosZ); Tessellator tessellator = Tessellator.instance; @@ -102,6 +103,8 @@ public class LightningHandler { GL11.glDepthMask(true); GL11.glTranslated(interpPosX, interpPosY, interpPosZ); + GL11.glPopMatrix(); + profiler.endSection(); profiler.endSection();