PDA

View Full Version : Matrices in OpenGL.. (memory org.)



royconejo
04-08-2001, 03: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.

Won
04-08-2001, 04:44 PM
Yes, I believe you are correct.