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.
Screw it, here it is (no guarantees, this is untested):
// width and height are vertex count
#define MESH_WIDTH 16
#define MESH_HEIGHT 16
// using your promotion of int to float
// degenerate stitching of rows
It wastes a couple of degenerates at the end but that’s negligible and optimizing it would actually be slower.