On Aug 5, 2008, at 12:24 AM, Ian Mallett wrote:
#World
HeightMapTexture,HeightMapSurface = LoadSurfaceTexture('Data/
Landscapes/'+World+'/HeightMap.png',Surface=True,filter=False)
WorldTexture = LoadSurfaceTexture('Data/Landscapes/'+World+'/
Texture.png')
dlSeaBed = glGenLists(1)
glNewList(dlSeaBed, GL_COMPILE)
glPushMatrix()
glDisable(GL_LIGHTING) #presently no lighting data
glBindTexture(GL_TEXTURE_2D,WorldTexture)
width = HeightMapSurface.get_width()
fwidth = float(width)
height = HeightMapSurface.get_height()
fheight = float(height)
Data = LandscapeData.main(World)
for z in xrange(height-1):
glBegin(GL_TRIANGLE_STRIP)
for x in xrange(width):
glTexCoord2f(x/fwidth,z/fheight)
glVertex3f(x,Data[z][x],z)
glTexCoord2f(x/fwidth,(z+1)/fheight)
glVertex3f(x,Data[z+1][x],z+1)
glEnd()
glEnable(GL_LIGHTING)
glPopMatrix()
glEndList()
This could be optimized readily using a vertex array (or VBO) instead
of immediate mode. In fact, if building the array is prohibitively
expensive, it could be readily stored and loaded from disk,
effectively allowing you to load the display list by loading the
vertex array (since that's basically all that's in there).
-Casey