royconejo

04-08-2001, 04:34 PM

Hi, I'm trying to do an 'OpenGL compliant' matrix, but I don't know if the memory organization of my own matrix is the same as OpenGL: float m[columns x 4][rows x 4]. I know that the OpenGL matrix is "a 4x4 matrix stored in column-major order as 16 consecutive values." (taken from glMultMatrix) but I can't figure out what it means..

Should I take this raw data: 1, 2, 3, 4, 5, 6, 7, 8... as one column of [1 2 3 4] and another column of [5 6 7 8] (1st row is [1 5 ..], 2nd row [2 6 ..])..???

For example:

raw data in memory: a b c d 5 6 7 8 9 10 11 12 13 14 15 16

(array of 16 floats)

My own matrix format reads that raw data as:

|.a .b .c .d|

|.5 .6 .7 .8|

|.9 10 11 12|

|13 14 15 16|

but OpenGL uses the same data as:

|a 5 .9 13|

|b 6 10 14|

|c 7 11 15|

|d 8 12 16|

am I rigth?

Well, Thanks for your help !...

- Royconejo.

Should I take this raw data: 1, 2, 3, 4, 5, 6, 7, 8... as one column of [1 2 3 4] and another column of [5 6 7 8] (1st row is [1 5 ..], 2nd row [2 6 ..])..???

For example:

raw data in memory: a b c d 5 6 7 8 9 10 11 12 13 14 15 16

(array of 16 floats)

My own matrix format reads that raw data as:

|.a .b .c .d|

|.5 .6 .7 .8|

|.9 10 11 12|

|13 14 15 16|

but OpenGL uses the same data as:

|a 5 .9 13|

|b 6 10 14|

|c 7 11 15|

|d 8 12 16|

am I rigth?

Well, Thanks for your help !...

- Royconejo.