I’m wondering if there’s any technical reason that a matrix is stored in shader matrix variable/uniform in column major order (hence transposed) by default, and this is regardless of whatever you specify for the [transpose] parameter in the glUniformMatrix.
I mean is it just a convention or there’s a real technical reason for this to be the default even in Direct3D HLSL, it’s the default, unless otherwise specified.
I mean is it just a convention or there’s a real technical reason for this to be the default even in Direct3D HLSL, it’s the default, unless otherwise specified.
There are several reasons. First, column major is the convention used by pretty much every mathematics textbook ever written. They settled on column major years ago.
Second, it does make vector/matrix multiplies easier to do. In a row-major matrix, the 4 vectors are the rows of the matrix. To multiply this with a vector takes 4 dot products. In a column-major matrix, the 4 vectors are columns. To multiply this with a vector takes 4 vector MAD instructions. And nowadays, with IEEE-754-2008 support for FMA, you get better precision from doing 4 FMAs than 4 dot products. And likely better performance.