Fix flickering due to incorrect state restoration

This commit is contained in:
mcrcortex
2025-05-29 18:51:31 +10:00
parent f9d1d9961b
commit ea930ad917

View File

@@ -21,6 +21,7 @@ import net.minecraft.world.biome.ColorResolver;
import net.minecraft.world.chunk.light.LightingProvider; import net.minecraft.world.chunk.light.LightingProvider;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.joml.Matrix4f; import org.joml.Matrix4f;
import org.lwjgl.opengl.GL14;
import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL14C.glBlendFuncSeparate; import static org.lwjgl.opengl.GL14C.glBlendFuncSeparate;
@@ -292,6 +293,10 @@ public class ModelTextureBakery {
glBindFramebuffer(GL_FRAMEBUFFER, this.capture.framebuffer.id); glBindFramebuffer(GL_FRAMEBUFFER, this.capture.framebuffer.id);
glClearDepth(1); glClearDepth(1);
glClear(GL_DEPTH_BUFFER_BIT); glClear(GL_DEPTH_BUFFER_BIT);
if (layer == RenderLayer.getTranslucent()) {
//reset the blend func
GL14.glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
}
} }