To read a pixel from screen use code below
Local pix:Byte[4]
glReadPixels ( screenx, screeny-1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, byte ptr pix )
pix then will have r,g,b in pix[0] pix[1] and pix[2]
Or just make an array the width of the terrain and keep the heights in it for each verticle scanline then just use the x position in array to read in height.
Local pix:Byte[4]
glReadPixels ( screenx, screeny-1, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, byte ptr pix )
pix then will have r,g,b in pix[0] pix[1] and pix[2]
Or just make an array the width of the terrain and keep the heights in it for each verticle scanline then just use the x position in array to read in height.