Efficiency Of Display Lists In OpenGL With Python?
I have been teaching myself OpenGL programming using the Python wrapper PyOpenGL, and am now working on my first project with it. This project is a music visualizer (not dissimila
Solution 1:
It is like the common sense was wrong. You manually restore the transformation (glTranslatef(-x,-y,-z)
) after drawing the cube
, this way glPopMatrix
is not only called twice for no reason, but it is also useless because you did all the work for it.
Correct code would like like so:
for x in xrange(...):
for z in xrange(...):
y = height[x,z] #numpy array
glPushMatrix() #Remember the matrix
glTranslatef(x,y,z) #change the matrix
glColor((r,g,b))
glCallList(cube)
glPopMatrix() #Restore tha matrix as it was before glTranslate changed it
Post a Comment for "Efficiency Of Display Lists In OpenGL With Python?"