Skip to content

jseling/3D-Terrain-Programming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

3D Terrain Programming

A serie of examples increasing the complexity example-by-example.

Based on Focus on 3D Terrain Rendering by Trent Polack.

1-Basic brute force

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;

About

A serie of examples increasing the complexity example-by-example. (WIP)

Topics

Resources

Stars

Watchers

Forks

Languages