Skip to content

Commit

Permalink
Merge branch 'no-texture'
Browse files Browse the repository at this point in the history
  • Loading branch information
FalsePattern committed Jul 15, 2024
2 parents 5ea71ba + 1006421 commit 6ef55c8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main/java/com/falsepattern/lib/util/RenderUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@
package com.falsepattern.lib.util;

import com.falsepattern.lib.StableAPI;
import com.falsepattern.lib.internal.Tags;
import com.falsepattern.lib.internal.render.ClampedIcon;
import com.falsepattern.lib.internal.render.FullTextureIcon;
import lombok.SneakyThrows;
import lombok.experimental.UtilityClass;
import lombok.val;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;

import net.minecraft.client.Minecraft;
Expand All @@ -45,6 +47,7 @@
@StableAPI(since = "0.8.0")
public final class RenderUtil {
private static final Timer MINECRAFT_TIMER = getMinecraftTimer();
private static final ResourceLocation EMPTY_TEXTURE = new ResourceLocation(Tags.MODID, "textures/gui/empty_texture.png");

/**
* Sets the OpenGL translation, relative to the player's position.
Expand Down Expand Up @@ -95,6 +98,19 @@ public static IIcon wrapAsClampedIcon(IIcon icon) {
return new ClampedIcon(icon);
}

/**
* Binds an empty texture.
* <p>
* When rendering without shaders, using {@link GL11#glDisable(int)} with {@link GL11#GL_TEXTURE_2D}
* is sufficient to achieve the same effect.
* <p>
* However, when shaders are enabled, disabling textures using this method will have no effect. Therefore this method can be used as a workaround.
*/
@StableAPI.Expose(since = "1.3.0")
public static void bindEmptyTexture() {
getMinecraft().renderEngine.bindTexture(EMPTY_TEXTURE);
}

/**
* Provides the partial tick between the last and next client tick, in the range of 0 to 1.
* <p>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6ef55c8

Please sign in to comment.