PDA

View Full Version : Custom color interpolation within a polygon



sansan
03-11-2003, 02:01 PM
In smooth shading (RGBA mode), if I provide separate colors for every vertex in a polygon, OpenGL performs linear color interpolation between vertices. E.g., if two adjacent vertices in quadrangle are red and two others are blue, there is a smooth transition from red to blue through the RGB color (0.5, 0, 0.5).
BUT THIS IS NOT WHAT I NEED.
I would like OpenGL to produce a smooth transition between red and blue through well-known color scale (roughly, red-orange-yellow-green-cyan-blue).
One possible way I know is to use color index mode. But I'd like to make sure that it's impossible - or how is it possible - to do the things in RGBA mode.
Could anybody give any hint?

Zeno
03-11-2003, 02:19 PM
Use a 1-D texturemap with your color scale and give each vertex an appropriate texture coordinate.

-- Zeno