#Render example from docs don't work.

7 messages · Page 1 of 1 (latest)

jovial stump
#

I recently decided to repeat the example of rendering from fabric docs to play around with, but even though I didn't get any errors, nothing is "drawn" on the screen. I would be very grateful if someone could explain to me what I was doing wrong. (1.21.1 yarn)

Code:

Environment(EnvType.CLIENT)
public class SimpleRender {

    public static void render() {
        HudRenderCallback.EVENT.register((context, tickDeltaManager) -> {
            if(MinecraftClient.getInstance().player != null) {
                Tessellator tessellator = Tessellator.getInstance();
                BufferBuilder buffer = tessellator.begin(VertexFormat.DrawMode.TRIANGLES, VertexFormats.POSITION);
                MatrixStack matrices = context.getMatrices();

                matrices.push();

                buffer.vertex(100, 100, 100);
                buffer.vertex(120, 100, 100);
                buffer.vertex(100, 120, 100);

                matrices.pop();
            }
        });
    }
}
rocky cloud
#

if you are on newer versions, use HudElementRegistry

jovial stump
rocky cloud
jovial stump
rocky cloud