procedure TForm1.Render;
var x,z:integer;
u,v:real;
begin
glClear(GL_COLOR_BUFFER_BIT
or GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity;
gluPerspective(45.0, ClientWidth/ClientHeight,NEAR_CLIPPING,FAR_CLIPPING);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity;
glTranslatef(-COUNT_X/2, -3, -14);
glRotatef(45,1,0,0);
fTexture.Bind;
u:=1 / COUNT_X; v:=1 / COUNT_Z;
for z:=0
to COUNT_Z-1
do
begin
glPushMatrix;
for x:=0
to COUNT_X-1
do
begin
glBegin(GL_QUADS);
glTexCoord2f(u*x,V*(z+1));
glVertex3f(0,map[x,z+1],0);
glTexCoord2f(u*x,v*z);
glVertex3f(0,map[x,z],1);
glTexCoord2f(u*(x+1),v*z);
glVertex3f(1,map[x+1,z],1);
glTexCoord2f(u*(x+1),v*(z+1));
glVertex3f(1,map[x+1,z+1],0);
glEnd;
glTranslatef(1,0,0);
end;
glPopMatrix;
glTranslatef(0,0,-1);
end;
SwapBuffers(
DC);
end;