A serie of examples increasing the complexity example-by-example.
Based on Focus on 3D Terrain Rendering by Trent Polack.
In: Delphi(GLScene)
Load a bitmap and render a very plain 3D Terrain without any optimization.
var
z, x: integer;
h: byte;
y: single;
//***
for z := 0 to FHeightField.DimensionLength - 2 do
begin
glBegin(GL_TRIANGLE_STRIP);
for x := 0 to FHeightField.DimensionLength - 1 do
begin
h := FHeightField.GetValue(x, z);
y := h * SCALE;
glColor3ub(h, h, h);
glVertex3f(x, y, z);
h := FHeightField.GetValue(x, z + 1);
y := h * SCALE;
glColor3ub(h, h, h);
glVertex3f(x, y, z + 1);
end;
glEnd;
end;