OpenGL - Terrain Problem or Perspective code wrong

BlitzMax Forums/BlitzMax Programming/OpenGL - Terrain Problem or Perspective code wrong

okay this maybe stupid part of me, but im trying to load a Heighmap from a png or whatnot..

can someone show me the correct way to load a heightmap using a pixmap and readpixel


Function Load:Int(file:String, xx:Int, zz:Int)
	
		Terrain:TTerrain = New TTerrain
		Terrain.X = xx
		Terrain.Z = zz
		Terrain.ID = Terrain.ID + 1
		
		Terrain.HeightMap = LoadPixmap(file)
		
		For Local xxx = 0 To TERRAIN_SIZE-1
			For Local zzz = 0 To TERRAIN_SIZE-1
				Terrain.Height[xxx,zzz] = ReadPixel(Terrain.HeightMap,xxx,zzz)
			Next
		Next
		
		ListAddLast(TerrainList,Terrain)
		
		Return Terrain.ID
	
	End Function



this doesn't work at all :(