Original Post
Hi,
there is a strange problem with my heightmap generator.
Look at this screenies:
http://www.husser.de/wireframe.jpg
http://www.husser.de/wireframe2.jpg
The terrain looks nice, but there are some additional polygons under the terrain. It seems, that there are some polys that have vertices on opposite sides of the terrain.
The heightmap loaded is of the size width*height pixels and the resulting vertices are written to a vertex buffer in the same order.
Now I create the Index Buffer with the following code:
In my current code, the heightmap is of size 257*257.
It creates 2 triangles from every quad of 4 vertices. No optimization for triangle strips, cause I use a LOD algorithm, so I can't use it.
Any ideas, what's wrong with the code?
thx,
fallen
[edited by - The_Fallen on March 6, 2003 12:26:42 PM]
[edited by - The_Fallen on March 6, 2003 12:36:43 PM]
m_IndexCount = (width-1)*(height-1)*6;
m_Indices = new int[m_IndexCount];
int vert=0;
for (x=0; x<height-1; x++)
{
for (y=0; y<width-1; y++)
{
m_Indices[vert++] = x*width+y;
m_Indices[vert++] = x*width+y+1;
m_Indices[vert++] = x*width+y+width;
m_Indices[vert++] = x*width+y+1;
m_Indices[vert++] = x*width+y+width+1;
m_Indices[vert++] = x*width+y+width;
}
}