Problems with the bgfx and jme api combination

I know this question seems a bit out of the realm of jme,But curiosity drove me on.

       bgfx_set_view_transform(0, view.get4x4(viewBuf), proj.get(projBuf));
       
       bgfx_set_view_transform(0,cam.getViewMatrix().toFloatBuffer(),cam.getProjectionMatrix().toFloatBuffer());

brief introduction: bgfx_set_view_transform Can accept a view matrix and a projection matrix

        cam.setFrustumPerspective(45f, (float) cam.getWidth() / cam.getHeight(), 0.1f, 1000f);
        cam.setLocation(new Vector3f(-10f, 0f, 0f));
        cam.lookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y);

I copied the initialization of the camera from the LegacyApplication class

bgfx_set_view_transform(0,cam.getViewMatrix().toFloatBuffer(),cam.getProjectionMatrix().toFloatBuffer());

But it doesn’t seem to be working so well. Instead of a square, there’s a long bar.

I can’t think of anything else that could go wrong.

Get back to me if you have any thoughts

You can try to transpose the matrices. My bgfx memory is rusted. Could be a colum/row major issue.

Matrix4f.fillBuffer(target, boolean) and try switching the boolean

2 Likes

If my memory serves me correctly zzuegg is correct about the column/row major issue. I’m pretty sure jME is the opposite of bgfx.

2 Likes

bgfx_set_view_transform(0,cam.getViewMatrix().toFloatBuffer(true),cam.getProjectionMatrix().toFloatBuffer(true));

You are right, thank you for your help this gives me even more motivation!

3 Likes