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?