I'll add the only new D bit in the code. I've used a nice way to initialize a dynamic multi-dimensional array.
First we have at the top of the module the declaration:
Then in initGL we initialize the array, like this:
points = new GLfloat(45, 45, 3);
Then we just loop through the indices and assign values to them.
Here's the whole code, and here's the flag texture.