Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
Fix 2D renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
gingerchicken committed Jun 13, 2023
1 parent ee7e8ea commit 76a2505
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main/java/net/como/client/utils/Render2DUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ public class Render2DUtils {
public static class BufferContainer {
Matrix4f matrix;
BufferBuilder bufferBuilder;
Tessellator tessellator;

private void open(MatrixStack matrixStack, VertexFormat.DrawMode drawMode, VertexFormat format) {
this.matrix = matrixStack.peek().getPositionMatrix();
this.bufferBuilder = Tessellator.getInstance().getBuffer();
this.tessellator = RenderSystem.renderThreadTesselator();
this.bufferBuilder = tessellator.getBuffer();

RenderSystem.setShader(GameRenderer::getPositionProgram);

this.bufferBuilder.begin(drawMode, format);
Expand All @@ -41,15 +44,15 @@ public BufferContainer(MatrixStack matrixStack) {
}

public void close() {
BufferRenderer.draw(this.bufferBuilder.end());
tessellator.draw();
}

public void vertex2D(int x, int y) {
this.bufferBuilder.vertex(x, y, 0).next();
this.bufferBuilder.vertex(matrix, x, y, 0).next();
}

public void vertex2D(double x, double y) {
this.bufferBuilder.vertex(x, y, 0).next();
this.bufferBuilder.vertex(matrix, (int)x, (int)y, 0).next();
}
}

Expand Down

0 comments on commit 76a2505

Please sign in to comment.