Make your own free website on Tripod.com

« May 2012 »
S M T W T F S
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Entries by Topic
All topics  «
Terrain
GL Experiments
Thu, 21 Apr 2005
Textured terrain problem
Topic: Terrain


Ugly and visible tiling effect around each triangle strip

Managed to render a terrain using a heightmap of 128x128 using triangle strips, but my problem is, the edges of the texture map are visibly ugly and obvious.

I need some advice, what is wrong with the code I used here?

void RenderTerrain()
{
int x,y,z,i,j;

glBindTexture(GL_TEXTURE_2D, g_textureID);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_BLEND);

glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
glColor3f(0,0.5f,0);
for (i=0;i {
for (j=0;j {
x=i*Zoom;
z=-j*Zoom;

glBegin(GL_TRIANGLE_STRIP);

glTexCoord2f(0,0);
glVertex3f(x,HeightMap[i][j],z);

glTexCoord2f(1,0);
glVertex3f(x+Zoom, HeightMap[i+1][j],z);

glTexCoord2f(1,1);
glVertex3f(x, HeightMap[i][j+1],z-Zoom);

glTexCoord2f(0,1);
glVertex3f(x+Zoom, HeightMap[i+1][j+1],z-Zoom);

glEnd();

} //end for j
} //end for i


Posted by glsiow at 12:42 PM JST
Updated: Thu, 21 Apr 2005 1:14 PM JST

Newer | Latest | Older