COLOR-INDEX ... What does it mean?

Hi,everyone,

I want to use glReadPixel() function to get the current color buffer, -the color value at each pixel-. It returns not RGB value, but “index value”. However, I don’t know what the COLOR_INDEX means. Who can give me a example of its usage.

good luck.

Best example of a color index system is window itself.

basically each component has it’s own index value and then colors are assigned to those index values so that you don’t have to store the fact that everything with index value 1 (say) has a color of (245,32,175 - again, just an example). When you go through the render look it looks up the values and renders appropriately.

Stephen

I have tried to use CDC::GetPixel() function to read colors. But if the window overlaped by other windows or dialogs (it’s not the toppest one), it always returns white color value at unseen area. So I want to use glReadPixel() to obtain color values.

This is the reason that I meet the trouble with the COLOR_INDEX problem.

Color index is another mode OpenGL supports besides RGB mode.
To make it relatively clear, HW color index mode is dead.
And the windows system itself is not always in color index mode, 16, 24 or 32 bits don’t know of an index, but use RGB.

GDI GetPixel() cannot read from underneath another window. Windows has nothing like backing storage on screen.
Neither can OpenGL’s glReadPixel. The specs define the result of pixel redback from unexposed window areas as undefined.