Archived

This topic is now archived and is closed to further replies.

DanielH

Terrain rendering?

Recommended Posts

How do i render a terrain quick? Right now i do it like this:
procedure DrawTerrain();

procedure SetColor(Height: GLfloat);
var
  X : GLfloat;
begin
  X := 256/10/100*Height+0.2;
  glColor3f(X,X,X);
end;

var
  X : Integer;
  Z : Integer;
begin
  for X := 0 to MapSize-2 do
  begin
    glBegin(GL_TRIANGLE_STRIP);
    for Z := 0 to MapSize-1 do
    begin
        glTexCoord2f(X/MapSize,Z/MapSize);
        SetColor(HeightMap[ind(X,Z)]);
         glVertex3f(X, HeightMap[ind(X,Z)], Z);
        glTexCoord2f(X/MapSize+1.0/MapSize,Z/MapSize);
        SetColor(HeightMap[ind(X+1,Z)]);
         glVertex3f(X+1, HeightMap[ind(X+1,Z)], Z);
    end;
    glEnd();
  end;
end;
 
this works for small terrains, but i want a huge landscape. How do i solve this? [edited by - DanielH on September 30, 2002 9:22:53 AM]

Share this post


Link to post
Share on other sites