Re: [PyOpenGL-Users] Modelview and projection matrices
Brought to you by:
mcfletch
|
From: Maciej K. <ma...@dg...> - 2002-01-05 23:42:38
|
On Sat, Jan 05, 2002 at 07:46:28AM -0500, Jan Ekholm wrote: > However, the Python versions return a [4][4] matrix, while the C versions > return a [16] array. The code on the page above uses a [16] array for all > indexing, so I'd like to translate the matrices I get from glGetFloatv to > arrays. > > The problem is now that I'm not sure how the returned matrix should be > "flattened". Should I go by row or column, i.e. the first element in the > array should be [0][0], but should the second be [0][1] or [1][0] and so > on? The OpenGL matrices are stored in column-major order. That is, the elements from the flat [16] array correspond to the 4x4 matrix like this: [ 0 4 8 12 ] [ 1 5 9 13 ] [ 2 6 10 14 ] [ 3 7 11 15 ] (Reference: "man" page for glMultMatrix) -- Maciej Kalisiak|mac@] dgp.toronto.edu|www.] "He who laughs last thinks slowest!" dgp.toronto.edu/~mac] |