#### Archived

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

# Terrain problems

## Recommended Posts

I''m working on a terrain engine (for a physics project). I''m using triangle strips for each row of the terrain. All data is stored in a single array (ie adjacent row''s data bumps up against each other). I''m getting an anomaly when rendering however. What appears to happen is that there is a gap between each row of triangles. This leaves strips of empty space across my entire ground. This isn''t exactly the look I was going for, so any help would be greatly appreciated. This is the rendering code for this section:
int height = ft.getHeight();  // really is depth
int width = ft.getWidth();
float[] surface = ft.getSurface();  // terrain data

gl.translatef(-100.0f, -150.0f, -200.0f);

for (y = 0; y < height - 1; y++) {         //  0--2--4
gl.begin(GL.TRIANGLE_STRIP);             //  | /| /|
for (x = 0; x < width; x++) {            //  1--3--5
gl.vertex3f(x, surface[x + y * height], y);
gl.vertex3f(x, surface[x + (y + 1) * height], y);
}
gl.end();
}


##### Share on other sites
Change in italics :

for (x = 0; x < width; x++)
{
gl.vertex3f(x, surface[x + y * height], y);
gl.vertex3f(x, surface[x + (y + 1) * height], y + 1 );
}

##### Share on other sites
That did it. Thanks a ton. Really explains why the gap got bigger over the length. Too bad I didn;t notice that earlier. Thanks again

• ### Forum Statistics

• Total Topics
628320
• Total Posts
2982057

• 12
• 9
• 9
• 13
• 11