How is GLKit's GLKMatrix “Column Major”?

后端 未结 3 584
悲&欢浪女
悲&欢浪女 2021-02-04 06:42

Premise A

When talking about \"Column Major\" matrices in linear memory, columns are specified one after another, such that the first 4 entries in mem

3条回答
  •  一向
    一向 (楼主)
    2021-02-04 07:02

    The problem in Premise B is that you assume that A "row" in a GLKMatrix4 is a set of 4 floats declared horizontally ([m00, m01, m02, m03] would be the first "row").

    We can verify that simply by checking the value of column in the following code:

    GLKMatrix3 matrix = {1, 2, 3, 4, 5, 6, 7, 8, 9};
    GLKVector3 column = GLKMatrix3GetColumn(m, 0);
    

    Note: I used GLKMatrix3 for simplicity, but the same applies to GLKMatrix4.

提交回复
热议问题