BradlyP

12-02-2000, 09:51 PM

Hello,

OK, we all know that OGL stores it's matricies in arrays like this

[0] [4] [8] [12]

[1] [5] [9] [13]

[2] [6] [10] [14]

[3] [7] [11] [15]

Where the numbers in brackets are the indicies into the array. The part I'm confused about is that I thought this was the standard arangement for a transformation matrix:

ix iy iz X

jx jy jz Y

kx ky kz Z

0 0 0 1

Where <ix, iy, iz> is the i vector (the local x axis), <jx, jy, jz> is the j vector (local y axis), <kx, ky, kz> is the k vector (can you guess?) and the point (X, Y, Z) is the location of the local coordinate system in the global coordinante system. So, using these two pieces of info, I'd expect OGL's modelview matrix to be constructed like this:

[0]ix [4]iy [8] iz [12]X

[1]jx [5]jy [9] jz [13]Y

[2]kx [6]ky [10]kz [14]Z

[3] 0 [7] 0 [11] 0 [15]1

But my first try at using my j <[1],[5],[9]> and k <[2],[6],[10]>vectors with gluLookAt() was unsuccessful. I couldn't figure it out, so I just tried something I didn't think would work, and it did! I used <[4],[5],[6]> for my j matrix and <[8],[9],[10]> for my k matrix. So it seems, from experimentation, that OGL stores the ModelView matrix like this:

[0]ix [4]jx [8] kx [12]X

[1]iy [5]jy [9] ky [13]Y

[2]iz [6]jz [10]kz [14]Z

[3] 0 [7] 0 [11] 0 [15]1

Is this correct? If so, I assume the other matricies are also stored like this... is that the case?

Thanks,

-BradlyP

[This message has been edited by BradlyP (edited 12-03-2000).]

OK, we all know that OGL stores it's matricies in arrays like this

[0] [4] [8] [12]

[1] [5] [9] [13]

[2] [6] [10] [14]

[3] [7] [11] [15]

Where the numbers in brackets are the indicies into the array. The part I'm confused about is that I thought this was the standard arangement for a transformation matrix:

ix iy iz X

jx jy jz Y

kx ky kz Z

0 0 0 1

Where <ix, iy, iz> is the i vector (the local x axis), <jx, jy, jz> is the j vector (local y axis), <kx, ky, kz> is the k vector (can you guess?) and the point (X, Y, Z) is the location of the local coordinate system in the global coordinante system. So, using these two pieces of info, I'd expect OGL's modelview matrix to be constructed like this:

[0]ix [4]iy [8] iz [12]X

[1]jx [5]jy [9] jz [13]Y

[2]kx [6]ky [10]kz [14]Z

[3] 0 [7] 0 [11] 0 [15]1

But my first try at using my j <[1],[5],[9]> and k <[2],[6],[10]>vectors with gluLookAt() was unsuccessful. I couldn't figure it out, so I just tried something I didn't think would work, and it did! I used <[4],[5],[6]> for my j matrix and <[8],[9],[10]> for my k matrix. So it seems, from experimentation, that OGL stores the ModelView matrix like this:

[0]ix [4]jx [8] kx [12]X

[1]iy [5]jy [9] ky [13]Y

[2]iz [6]jz [10]kz [14]Z

[3] 0 [7] 0 [11] 0 [15]1

Is this correct? If so, I assume the other matricies are also stored like this... is that the case?

Thanks,

-BradlyP

[This message has been edited by BradlyP (edited 12-03-2000).]