From 88374155c35dfc2a5822b706e593cb2b1df3db9a Mon Sep 17 00:00:00 2001 From: EternalBlueFlame Date: Sun, 17 Sep 2017 17:05:32 -0500 Subject: [PATCH] Optional fix for texture binding issues - Some GPU's may not give textures proper ID's so the check for if it's already bound can fail, so a config was added to force binding to prevent the issue. --- src/main/java/train/client/tmt/Tessellator.java | 10 ++-------- .../java/train/common/core/handlers/ConfigHandler.java | 2 ++ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/main/java/train/client/tmt/Tessellator.java b/src/main/java/train/client/tmt/Tessellator.java index ca87800f1a..b7d6e8175a 100644 --- a/src/main/java/train/client/tmt/Tessellator.java +++ b/src/main/java/train/client/tmt/Tessellator.java @@ -8,18 +8,12 @@ import net.minecraft.client.renderer.texture.SimpleTexture; import net.minecraft.client.renderer.texture.TextureUtil; import net.minecraft.util.ResourceLocation; -import org.lwjgl.BufferUtils; import org.lwjgl.opengl.GL11; +import train.common.core.handlers.ConfigHandler; -import javax.imageio.ImageIO; -import java.awt.*; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.net.URL; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; -import java.util.Arrays; import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D; @@ -134,7 +128,7 @@ public static void bindTexture(ResourceLocation textureURI) { object = TextureUtil.missingTexture; } - if (GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D) != object.getGlTextureId()) { + if (GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D) != object.getGlTextureId() || ConfigHandler.FORCE_TEXTURE_BINDING) { GL11.glBindTexture(GL_TEXTURE_2D, object.getGlTextureId()); } } diff --git a/src/main/java/train/common/core/handlers/ConfigHandler.java b/src/main/java/train/common/core/handlers/ConfigHandler.java index 4acb87771e..b930ba6a18 100644 --- a/src/main/java/train/common/core/handlers/ConfigHandler.java +++ b/src/main/java/train/common/core/handlers/ConfigHandler.java @@ -35,6 +35,7 @@ public class ConfigHandler { public static boolean REAL_TRAIN_SPEED; public static boolean RETROGEN_CHUNKS; public static boolean MAKE_MODPACKS_GREAT_AGAIN; + public static boolean FORCE_TEXTURE_BINDING; @@ -65,6 +66,7 @@ public static void init(File configFile) { MAKE_MODPACKS_GREAT_AGAIN = cf.getBoolean("MAKE_MODPACKS_GREAT_AGAIN", CATEGORY_GENERAL, false, "This will disable some of Traincrafts easier recipes to balance Modpacks"); WINDMILL_CHECK_RADIUS = cf.getInt("WINDMILL_CHECK_RADIUS", CATEGORY_GENERAL, 1, -1, 10, "This sets the radius for the can-see-the-sky-check area around the windmill. 0=only location of windmill, 1=3x3, 2=5x5 etc. Use -1 to turn of this check completely. DEFAULT: 1"); + FORCE_TEXTURE_BINDING = cf.get(CATEGORY_GENERAL, "Force_Texture_Binding", true, "Enable this if trains and rollingstock are using block/item textures").getBoolean(false); } catch (Exception e) { Traincraft.tcLog.fatal("Traincraft had a problem loading its configuration\n" + e);