You need to break out the graph paper. The lines have shown you what a mess your’e drawing, it’s also very inefficient w.r.t wasted fill. You’re hitting a LOT of pixels a LOT of times. and have random winding and other things going on due to the tristrip, it’s not just triangles you’re drawing, it really is a mess. You can’t possibly intend to draw what this code actually produces.
Then the post immediately above yours is the answer.
I do encourage you to look at vertex issue order and the primitives you are rendering until you gain some insight into the correct vertex issue order. I wasn’t joking when I said break out the graph paper, it will help.
This is a key thing to understand when drawing meshes.
P.S. that post draws quads, but I also encourage you to get tristrip rendering working. Your vertex issue order for triangle strips in a 16x16 grid of vertices is:
Screw it, here it is (no guarantees, this is untested):
// width and height are vertex count
#define MESH_WIDTH 16
#define MESH_HEIGHT 16
glBegin(GL_TRIANGLE_STRIP);
for(i=0;i<MESH_HEIGHT;i++)
{
for(j=0;j<MESH_WIDTH;j++)
{
// using your promotion of int to float
glVertex3f(j,i*MESH_WIDTH,0);
glVertex3f(j,(i+1)*MESH_WIDTH,0);
}
// degenerate stitching of rows
glVertex3f(j,(i+1)*MESH_WIDTH,0);
glVertex3f(0,(i+1)*MESH_WIDTH,0);
}
glEnd();
It wastes a couple of degenerates at the end but that’s negligible and optimizing it would actually be slower.