OpenGL - Terrain Problem or Perspective code wrong

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

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

The value returned by ReadPixel is in Integer RGB format. Meaning the Red, Green and Blue values need to be extracted from the value returned by ReadPixel and averaged to create the terrain height.

For Local xxx = 0 To TERRAIN_SIZE-1
	For Local zzz = 0 To TERRAIN_SIZE-1
		Local pix:Int = ReadPixel(Terrain.HeightMap,xxx,zzz)
		Local red:Int = ( pix Shr 16 ) & $FF
		local green:Int = ( pix Shr 8 ) & $FF
		Local blue:int = pix & $FF
		Local height:Int = (red+green+blue)/3
		Terrain.Height[xxx,zzz] = height
 	Next
Next
You may need to reposition the terrain a bit to be able to see it better.