Skip to main content
gamedev.net
🔒 Locked

Terrain rendering?

Started by DanielH Sep 30, 2002 at 8:13 AM 0 replies 400+ views
Original Post
DanielH
DanielH
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]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.