grid mesh

Hi all.
I have a 2 dimention array of vertexes with dynamic size. All the vertexes has a given color. I want to draw these as a grid and i want the colors to be interpolated throughout the whole grid.
today I draw them like this:


//this is a simple version of my drawing. I also calculate normals and set material for the lights
for (int x = 0; x < points.length; x++) {
 for (int y = 0; y < points[x].length; y++) {
  if (x == points.length - 1 || y == points[x].length - 1) {
  } else {
   gl.glColor4f(points[x][y].getWeightColor()[0], points[x][y].getWeightColor()[1], points[x][y].getWeightColor()[2], 1.0f);
   gl.glBegin(gl.GL_QUADS);
   gl.glVertex3d(points[x][y].getX(), points[x][y].getY(), points[x][y].getDrawnZ());
   gl.glVertex3d(points[x][y + 1].getX(), points[x][y + 1].getY(), points[x][y + 1].getDrawnZ());
   gl.glVertex3d(points[x + 1][y + 1].getX(), points[x + 1][y + 1].getY(), points[x + 1][y + 1].getDrawnZ());
   gl.glVertex3d(points[x + 1][y].getX(), points[x + 1][y].getY(), points[x + 1][y].getDrawnZ());
   gl.glEnd();
   }
  }
 }

but this will create lots of individual polygons/quads. The color will be interpolated within each quad, but I want the grid to interpolate betwen quads as well. If you know what i mean.
Is there a better way of doing this? with quadstrip/polygon or something else?

Give color to each vertex, then these colors will be interpolated.

Try the below code. It will create a Quad with four colors interpolated.

glClear( GL_COLOR_BUFFER_BIT );

glBegin(GL_QUADS);
glColor4f(1,0,0,1); // Red left bottom corner
glVertex3d(0, 0, 0);
glColor4f(0,1,0,1); // Green left top corner
glVertex3d(0, 1, 0);
glColor4f(0,0,1,1); // Blue  right top corner
glVertex3d(1, 1, 0);
glColor4f(1,1,1,1); // white right bottom corner
glVertex3d(1, 0, 0);
glEnd();

Thanks for the reply… This made it nicer to look at…
Do you know if theres a way to take the vertexes and make one big polygon out of it?

Do you know if theres a way to take the vertexes and make one big polygon out of it?

Not clear. what do u mean by big polygon ?

GL_POLYGON? (or better GL_TRIANGLE_FAN)

one big polygon… chose my words poorly there… I ment one big mesh.