how to create a grid / 2D mesh

I am trying to create a 2D mesh so i can do the Image warp but i don't want to create each vertex by hand. I will need to create a vertex array with all the vertices and to save memory will need to use a index array but to figure out the index array with in a for loop.

For better performance you might want to consider using a triangle strip for each column and join them together using degenerate triangles.

There's a lot of answers if you google for: "triangle strip grid"

Of if your strips are quite big, just create them as separate triangle strips and render them separately.

If you want triangle then you need something like this - though you should be able to work this out yourself - you just need to create two triangles for each square in the grid you want to render. Should look something like this: