[PyOpenGL-Users] Modelview and projection matrices
Brought to you by:
mcfletch
From: Jan E. <ch...@in...> - 2002-01-05 12:46:36
|
Hi, I've been trying to implement some form of view frustum culling. I found some interesting code on: http://www.markmorley.com/opengl/frustumculling.html The code is in C, so I need to translate it to Python. Central in that approach is the use the current modelview and projection matrices. So I get the using: projection = glGetFloatv ( GL_PROJECTION_MATRIX ) modelview = glGetFloatv ( GL_MODELVIEW_MATRIX ) 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? I have tried both ways, but my code still won't work, so I'd like to rule out at least this possibility for error. Ny ideas? Chakie -- The Emperor had all the qualifications for a corpse except, as it were, the most vital one. -- Terry Pratchett, Interesting Times |