int iCounter = 0;
//Vertices
for (int x = 0; x < numSideTiles+1; x++)
for (int z = 0; z < numSideTiles+1; z++)
{
float xPos = x * spacing;
float zPos = z * spacing;
vertices[x + z * (numSideTiles + 1)] = new PositionNormalTextured() { Position = new Vector4(xPos, 0, zPos, 1.0f), Normal = normal, UV = new Vector2(x, z) };
}
//Indices
for (int x = 0; x < numSideTiles; x++)
for (int z = 0; z < numSideTiles; z++)
{
ushort lowerLeft = (ushort)(x + z * (numSideTiles+1));
ushort lowerRight = (ushort)((x + 1) + z * (numSideTiles + 1));
ushort topLeft = (ushort)(x + (z + 1) * (numSideTiles + 1));
ushort topRight = (ushort)((x + 1) + (z + 1) * (numSideTiles + 1));
indices[iCounter++] = topLeft;
indices[iCounter++] = lowerRight;
indices[iCounter++] = lowerLeft;
indices[iCounter++] = topLeft;
indices[iCounter++] = topRight;
indices[iCounter++] = lowerRight;
}
Here is a picture of 5x5 quad, and as you can see it's a little different.
[attachment=9350:5x5quadWTFv2.png]
I'm thinking the problem is somewhere else than in the loop.