Original Post
I have been working on height maps for a bit now and got to working. The only thing is I get a wird artifact when i render it. Everything is fine except for one end of the height map has some polygons that shoot stright down. what i mean is its rendering at a certain height then the next vertex drops by 30 for no apparent reason. Not sure if anyone can help me with this or not, hopeing someone ran into this problem befor and can help me out. Will list my render code below. The Height map is 512 * 512. editing it to include a screen shot, not a great one.
void Terrain::RenderByBruteForce(void) {
if(HeightData == NULL) {
return;
}//end HeightData == NULL if
if(WidthX == 0) {
return;
}//end WidthX || WidthZ if
if(WidthZ == 0) {
return;
}//end WidthX || WidthZ if
float Xvalue, Zvalue, Xplusscalevalue;
int x, z;
for(x = 0; x < WidthX - 3; x += DetailScale) {
glBegin(GL_TRIANGLE_STRIP);
for(z = 0; z < WidthZ - 1; z += DetailScale) {
Xvalue = (float)x/WidthX;
Zvalue = (float)z/WidthZ;
Xplusscalevalue = (float)(x + DetailScale)/WidthX;
glTexCoord2f(Xvalue, Zvalue);
glVertex3f((float)x, GetHeight(x, z), (float)z);
glTexCoord2f(Xplusscalevalue, Zvalue);
glVertex3f((float)(x + DetailScale), GetHeight((x + DetailScale), z), (float)z);
}//end z for
glEnd();
}//end x for
}//end RenderByBruteForce