Uh, yep, OpenGL does this by default I believe. Just specify the color for each vertex and that’s it. glShadeModel sets the fill mode and is supposed to default to GL_SMOOTH. So for an immediate primitive do something like this:
glBegin(GL_TRIANGLES)
glColor3f(…); // color for vertex 1
glVertex3f(…); // vertex 1
glColor3f(…); // color for vertex 2
glVertex3f(…); // vertex 2
glColor3f(…); // color for vertex 3
glVertex3f(…); // vertex 3
glEnd();
That should do what you want although that’s not the best approach to use for a terrain renderer (using individual primitives I mean) instead look into strips and vertex arrays. Vertex arrays use a color array to specify color for each vertex in the vertex array.
You might want to take a look at NeHe’s tutorials , there might be something there that uses vertex arrays.
And as far as terrain renderers go, I know I just read about one recently on Gamasutra .