I want to draw a polygon representing an area. Each point in the area has its temperature property. So every points in the polygon may have different colors. The temperature is defined in each vertices of polygon, and it is assumed to linearly interpolated between vertices.
I can define two colors for the extreme temperature values, map them to two different colors, do linear mapping between these two temperature values.
for example, I let maximum temperature to be 100, and the minumn to be 0.
glColor4f( temp1/100, 0, 0);
glColor4f( temp2/100, 0, 0);
glColor4f( temp3/100, 0, 0);
However, this way can only do linear mapping. It cannot make the variable-color-mapping more visually comfortable. For example, I want to map the minumn value to green; when the variable increase, it goes to yellow; from yellow it changes to red when the color increase to maximum.
I want the [green]-[yellow]-[red] mapping, but if I define two vertices to green and red, I can only get [green]-[other color]-red, which does not meet requirement of color mapping.
How can I solve this problem? Thank you very much!