LookAt matrix and model matrix transpose

Started by Mihai_Ionut_Floares, November 15, 2020, 19:31:14

Previous topic - Next topic

Mihai_Ionut_Floares

Hi I encounter a weird thing:
I have a transformation matrix like this(since I want only to translate this will serve as model matrix too):

I have it as a float:

I have one stored as a float[][] in java that moves by 0.5 on every axis:
1 0 0 0.5
0 1 0 0.5
0 0 1 0.5
0 0 0 1

when I send it to glsl as a float[] I construct the float transposed like this:
1 0 0 0 0 1 0 0 0 0 1 0.5 0.5 0.5 1(first column represents the first 4 elements from array)

It works when I send it as a float[] like this

The view matrix:


I construct it like this and the final matrix is:
1.0 0.0 0.0 -4.0
0.0 1.0 0.0 -3.0
0.0 0.0 1.0 -3.0
0.0 0.0 0.0 1.0
(camera at 4 3 3, looking at 0 0 0 and up is at 0 1 0)

When I transpose it(first column represents the first elements of float[]) it isn't working. When I don't transpose it is working and I don't know why

The prjection matrix


I setup and the final mat is:
1.7320509 0.0 0.0 0.0
0.0 1.7320509 0.0 0.0
0.0 0.0 -1.002002 -0.2002002
0.0 0.0 -1.0 0.0

This isn't working even if I transpose it and I don't know why.
Please look at this screen capture and help me with setting up the matrices:
https://streamable.com/2o1m9t