PDA

View Full Version : gradient color ramp



jjordache
04-11-2005, 09:42 AM
greetings,

I would like to know if there's any type of hardware accelerated
option for gradient coloring a set of points based on their elevation
(z value). I need to implement a gradient color ramp, not just
gradient between two colors, for example, the classical: from blue, to
green to yellow to red.
I wrote a nice little class that gives me a RGB triplet based on a Z
value, and use it to set the current color inside glBegin(GL_POINTS)
and glEnd() for each point, but it visibly slows down the display.
So, is there any OpenGLish way of doing this?
Sorry if I missed the obvious, I'm new to this.
thanks!

mogumbo
04-11-2005, 09:49 AM
You can put your color gradient into a 1D texture and use glTexGen with the token GL_OBJECT_LINEAR to generate your texture coordinates.