Skip to content

ModelViewMatrix provides Identity matrix instead of modelview #3428

Discussion options

You must be logged in to vote

After getting better at graphics, I found a solution not long ago for this that works with DrawContexts. The code is somewhat like this:

// This is a (modified) code snippet from an existing project I'm working on, currently licensed under Apache-2.0.

// The place I sourced this matrix from was an @Inject Invoke at `applyModelViewMatrix` in WorldRenderer's `render`.
public void example(Quaternionf rotation, Matrix4f matrix, Vector3f pos){

        var camRot = new Quaternionf(MinecraftClient.getInstance().gameRenderer.getCamera().getRotation());

        var dc = new DrawContext(MinecraftClient.getInstance(),MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers());

…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by AnOpenSauceDev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
1 participant