Advertisement

OpenGL 4.2 LookAt matrix only works with -z value for eye position

Started by September 17, 2019 12:04 PM
22 comments, last by DBisar 5 years, 3 months ago

Aw. Outch ?

Yeah, looking at your first post more firmly it should have met my eye: the matrices are transposed.

In order to avoid problems at other places i suggest not to change the plutimication order but to transpose the matrices when setting the uniforms. It is a central place ...

Maybe i should add: in principle it doesn't matter how your program stores matrices, whether column or row major. As long as you deliver the matrix data to a uniform as a contiguous array of 16 floats, column after column in case of column major and row after row in case of row major ordering. Anyhow you store it - for example as an array of 4 vectors, column or row vectors banana, of arrays of 4 float each - the &matrix[0][0] (C/C++ notation) with a length of 16 floats will correctly transmit the column or row major data to glUniformMatrix4fv.

The OpenGL documentation says that for example in a model matrix, the transformation part must occupy the places 13, 14 and 15 in the array of 16 floats.

Half of the world laments a column-wise storage, the other half a row-wise. Both are correct. Do your own math lib, then you have the control ?

Advertisement

Thanks

This topic is closed to new replies.

Advertisement