PDA

View Full Version : display lists with colorscales



mithun_daa
11-26-2003, 08:24 AM
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

jwatte
11-26-2003, 08:29 AM
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!

mithun_daa
11-27-2003, 09:42 AM
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.

mithun_daa
11-27-2003, 03:15 PM
herez a link to a snapshot of my problem
www.geocities.com/mithunp4u (http://www.geocities.com/mithunp4u)