Rainbow color band and color palettes in OpenGL?

Hi

How to manage different colour palettes in OpenGL? Basically I want to display a set of 2d points and points must be colored based on the depth value at that particular point. The depth value may range from -ve to +ve say -25m to 3000m. So how do I color these set of points using rainbow colorband?

Exactly that's the word. Lookup table. I don't want to hard code it every time. The logic you mentioned, I did used once, but for testing and it works fine for small number of points. So if number of points are more, then iterating all points and checking for height is time consuming isn't it? Presently I am working with VBOs. Based on the input array, the range must be automatically selected and the color palette should be used, the one which user selects. I googled up in regards to this, and I got this article (though it is quite old)

It suites my requirement. But wondering how to go ahead with this. Any idea or clue?

As far as shaders are concerned, I tried a small example on shaders. I got the compilation error. vertex and fragment gets loaded but do not gets compiled. Is it that my system doesn't support shading programming. I am working with OpenGL 2.0. I am not sure whats going wrong. Any comments on this?

Color index mode is highly unlikely to be supported well or even hardware accelerated. Could you elaborate some more about what errors you got when you tried shaders? I ask because the classic approach to this would be to encode a palette in a 1D texture and fetch the colour from it in a vertex shader.

The sample shader program which I tested was having some problem. I got another example which displays an ellipse using shaders. IT works fine. Now I am experimenting on shader programming. Can you direct me towards a material, or link or article which helps me to understand how to encode a palette in a 1D texture and fetch color from it?

I went through various links and tried to implement them. The examples mentioned here, also executes well. I went through the teapot example mentioned in The Redbook here on the online version. The redbook example when executed seperately works fine. But instead on teapot if I plot some points, it doesn't produce appropriate result. Though this is very old one and doesn't use shaders. After reading some more literature, I was able to write my own shaders(of course with help of other examples)

Which this set up I do get colored points. But, 4 points are of same color and remaining points are of same color. My question here is,

1) Is Texture 1D lookup construction what I have done is correct?
2) If so, then how is the range of colors will be computed? For example, in the above test file, the range is -500 to 3346. This range how should be supplied so that the color map should take place only for values falling within this range.?

I'm sure that I am missing something somewhere. But where I am not able to locate. Some one please help me out.