|
23 | 23 | package com.falsepattern.lib.util;
|
24 | 24 |
|
25 | 25 | import com.falsepattern.lib.StableAPI;
|
| 26 | +import com.falsepattern.lib.internal.Tags; |
26 | 27 | import com.falsepattern.lib.internal.render.ClampedIcon;
|
27 | 28 | import com.falsepattern.lib.internal.render.FullTextureIcon;
|
28 | 29 | import lombok.SneakyThrows;
|
29 | 30 | import lombok.experimental.UtilityClass;
|
30 | 31 | import lombok.val;
|
| 32 | +import net.minecraft.util.ResourceLocation; |
31 | 33 | import org.lwjgl.opengl.GL11;
|
32 | 34 |
|
33 | 35 | import net.minecraft.client.Minecraft;
|
|
45 | 47 | @StableAPI(since = "0.8.0")
|
46 | 48 | public final class RenderUtil {
|
47 | 49 | private static final Timer MINECRAFT_TIMER = getMinecraftTimer();
|
| 50 | + private static final ResourceLocation EMPTY_TEXTURE = new ResourceLocation(Tags.MODID, "textures/gui/empty_texture.png"); |
48 | 51 |
|
49 | 52 | /**
|
50 | 53 | * Sets the OpenGL translation, relative to the player's position.
|
@@ -95,6 +98,19 @@ public static IIcon wrapAsClampedIcon(IIcon icon) {
|
95 | 98 | return new ClampedIcon(icon);
|
96 | 99 | }
|
97 | 100 |
|
| 101 | + /** |
| 102 | + * Binds an empty texture. |
| 103 | + * <p> |
| 104 | + * When rendering without shaders, using {@link GL11#glDisable(int)} with {@link GL11#GL_TEXTURE_2D} |
| 105 | + * is sufficient to achieve the same effect. |
| 106 | + * <p> |
| 107 | + * However, when shaders are enabled, disabling textures using this method will have no effect. Therefore this method can be used as a workaround. |
| 108 | + */ |
| 109 | + @StableAPI.Expose(since = "1.3.0") |
| 110 | + public static void bindEmptyTexture() { |
| 111 | + getMinecraft().renderEngine.bindTexture(EMPTY_TEXTURE); |
| 112 | + } |
| 113 | + |
98 | 114 | /**
|
99 | 115 | * Provides the partial tick between the last and next client tick, in the range of 0 to 1.
|
100 | 116 | * <p>
|
|
0 commit comments