display lists with colorscales

i have a display list that displays a terrain. now i also have a colorscale that assigns different colors for different heights. is there any way that i can color the whole display list with a new colorscale without having to generate a new list.

pseudo code :

glcolor colorscale
glcalllist terrain

glColor() sets a color. If the list doesn’t re-set the color, then a call to glColor() will set the incoming vertex color (or color material) that’s active when the list geometry gets drawn.

What you want to do is probably to use more than one color, for different heights, at the same time. You can do this by sticking the color ramp into a 1 pixel tall, N pixels wide texture, and using GL_S OBJECT_LINEAR texgen. Set the texgen plane to the Y vector scaled by the inverse of the height if your field.

More details available under OBJECT_LINEAR in the red book, or the freely downloadable OpenGL specification PDF (available on the front page of this site).

Good luck!

Originally posted by jwatte:
Set the texgen plane to the Y vector scaled by the inverse of the height if your field.

could u plz elaborate on this. its a little too much for me to follow.

herez a link to a snapshot of my problem
www.geocities.com/mithunp4u