row or column major matrix types

Here’s another question about a detail:

It’s clear that matrices of glsl-type like glsl_float4x4 are column major, and those of cg-type (cg_float4x4) are row-major.

I guess those of type float4x4 (simple-type) as referenced in the fx_basic_type_common are also row-major… is that right?

thnx

  • h

The spec for the <matrix> element states that COLLADA matrices are column-major ordered. I would assume that the COMMON fx_basic_type_common float4x4 is the same.

-Andy

[Admin: edited to column-major]

I just wrote a little piece of code comparing values of e.g. domFx_basic_type_common and domGlsl_param_type. After reading this old thread again, I was puzzled about the answer regarding the float4x4 internal format. Because the spec says:

page 93:

Matrices in COLLADA are column matrices in the mathematical sense. These matrices are written in row-
major order to aid the human reader. See the example below.

So in fact the answer about the programmatic matrix format is row-major, not column-major, which is, of course, very important when comparing matrix-values of different profiles.

  • h

Hi,

could you open a bug against the spec in the khronos bugzilla ?

Regards

There is not really any wrong statement in the spec. You just have to be aware of the difference of vector convention, which is column-order, and the actual storage format which is row-major. But if you just quickly skim through this section of the spec you might mistake the column-order vector convention as the memory layout.

Anyway, i opened a bug to emphasize the storage format in the Spec:

http://www.khronos.org/bugzilla/show_bug.cgi?id=49

If somebody is interested, this is a nice article about matrix formats and common mistakes of using them:

http://www.mindcontrol.org/~hplus/graph … ayout.html

  • h