There are a number of ways to represent scalar data values for visualization. The most obvious is color. A set of color values can be used to represent the range of values the data can assume. There are a few issues that must be considered when choosing color values. First, there are large set of color values that can be used to represent the color range. The colors should be chosen to make the values intuitive. A common technique is to use ``cold'' colors such as black, purple, blue for low values, and ``hot'' colors such as red, orange, and white to represent high values. Sometimes green hues are used to fill in the mid-range values. This ties into viewer expectations about heat and color, indicating the ``energy'' of the data values.
Colors tailored to the application space will give the most mileage. If the goal is to notice data discrepancies, make those values stand out from the rest of the color range. For example, unusual values can be shaded with red hues, with the rest of the value range shades of green. The color range can be made consistent by changing only the hue, fixing the saturation and brightness to only slow changes over the entire data range.
In general, chose one or more ``color paths'' through RGB color space to represent the data range, taking psychological and application specific factors into account.
Once colors are chosen, there are a number of ways to render them. The most obvious way is to map the data values to RGB values directly in the application. OpenGL can be used to simplify and accelerate the process and reduce the amount of work performed in the application.
One obvious way is to use color index values, choosing a colormap where data values index the desired colors. This approach is not recommended, however, for a number of reasons. First, it is a limited approach. Color index values must be integers, and the allowable range of values is limited by the maximum size of the colormap. Second, graphics API implementations are moving away from color index support, and many implementors don't emphasize the color index part of their implementations. Color index applications may be unaccelerated, and possibly not as well implemented as the RGBA path.
Fortunately, there is a better way to provide a mapping between data values and rgb colors: texture maps. The texture map can provide a mapping between data values, input as texture coordinates, to colors, which are mapped as colors in the texture map itself. Texture mapping is optimized and hardware accelerated on almost every implementation of OpenGL at the time of writing, and arbitrarily large mappings can be created using one or more texture maps.
A simple example might clarify this technique. Imagine a set of 50 data values to map colors onto: