I’m quoting the specification.

http://www.opengl.org/archives/resources/faq/technical/transformations.htm

The Wikipedia article on row-major (etc.) states that it actually is about memory layout, but if that is strictly true then it contradicts itself because it also says OpenGL/OpenGL ES are column-major, even though their matrices (as produced by their own matrix functions) are stored as described in the article’s row-major section in RAM.

There's no contradiction - the GL spec describes a column-major array indexing scheme -- that element #0 is row0/col0, and element #4 is row0/col1 (*x=1,y=0*), **not** row1/col0 (*x=0,y=1*) as in row-major ordering.

Your FAQ link says *"OpenGL matrices are 16-value arrays with base vectors laid out contiguously in memory. The translation components occupy the 13th, 14th, and 15th elements of the 16-element matrix",* but it fails to mention that these base vectors are columns. The fact that it fails to mention it seems to imply that they think that there is a consensus that everyone knows that column-vectors are everyone's default choice or something...

i.e. If we label the 4x4 matrix elements as:

0123

4567

89AB

CDEF

The GL spec says that the LoadMatrix function expects those items to be ordered in RAM as 0,4,8,C,1,5,9,D,2,6,A,E,3,7,B,F, and that the translation components will be in 3, 7 and B.

Your link doesn't spell this out, but it does refer to section 2.11.2 of the spec, which does explicitly state all this.

So the GL specification for it's fixed function pipeline is based around column-major array notation (store the items in RAM by writing out each column), and it also specifies that it expects you to be using column-vectors (*the basis vectors are stored in the mathematical columns of the matrix*).

It also defines LoadTransposeMatrix (*instead of the usual LoadMatrix*), which is defined to accept a matrix stored in row-major array notation, but still using column vectors (*i.e. the translation components are still in 3/7/B, but the storage ordering in ram is now 1,2,3,4,5...*). What is this kind of matrix called? It's "column major" according to your definition as it uses the multiplication ordering required of column-vectors, but in RAM the elements are stored using the computer-science row-major array addressing convention! It's a column-vector matrix stored as row-major.

This is just the spec for fixed-function stuff though. Modern GL/D3D don't have math libraries, requiring you to make your own choice about conventions.

On the GLSL/HLSL side where matrices are used, you're free to choose column-vectors or row-vectors, and you're free to choose the RAM storage scheme, e.g. with column_major or row_major keywords (*these keywords ***only** affect the RAM storage scheme, they don't affect the maths at all).

You can use the two common choices of column-vector matrices stored in column-major, or row-vector matrices stored in row-major, but can also use the less common column-vector matrices stored in row-major and row-vector matrices stored in column-major!

Matrix majorness in computer science is specifically used to describe the order of multiplication, not the memory layout.

In my experience, it only describes the memory layout -- arrays are much more of a common computer science topic than 4x4 matrices are. Every programmer or language designer needs to deal with column-vs-row array storage conventions, but not everyone has to deal with transformation matrices. Transformation matrices just inherit this problem because they happen to be a 2-dimensional matrix.

Moreover, the issue of whether you store your basis vectors in the rows or columns of your matrix is a mathematical problem -- it exists when doing math on paper, completely independent of computer-science issues. If one mathematician on a project is storing basis vectors in rows and treating his vectors as row-vectors, while the rest or treating their vectors as column-vectors and storing basis-vectors in columns, you're gonna have a bad time.

When we start using matrices in computer-land, we inherit both these problems. Do we store our basis vectors in rows/columns (do we treat vectors are row-vectors or column-vectors), and also how to we address our 2d arrays?

I submit that in computer science “row major” and “column major” actually refer to the expected result given an order of multiplication

You just quoted a wikipedia article that disagrees, so, citation needed?

In maths though, where all the computer complications don't apply, I've seen "row-vector matrices" and "column-vector matrices" called row-major/column-major, post-fix/pre-fix, post-concatenate/pre-concatenate... I what the standard mathematical jargon for those two styles is.

But, these guys pre-date the transistor, so if they're calling their matrices designed for the row-vector convention "row-major", then it's a bit of math jargon, not comp-sci jargon... which is confusing, because in comp-sci row/column-major usually refer to 2D array indexing schemes.

**Edited by Hodgman, 03 April 2014 - 10:58 PM.**