GL_COLOR_INDEX and glDrawPixels

I developed one application in which i draw one line for evry 1 milli second depending upon receving data(signal strength).
depending on signal strength now i am setting pixel color as
for (j = 10400; j < 13600; j++)

                checkImage[i][zindex][0] = ZTable[j].SigLevel+90;
               // qDebug()&lt;&lt;"signal strength"&lt;&lt;ZTable[j].SigLevel;
                checkImage[i][zindex][1] = ZTable[j].SigLevel+90;
                checkImage[i][zindex][2] = ZTable[j].SigLevel+50;



    //qDebug()&lt;&lt;" After memcpy";

    for (j = 10400; j &lt; 13600; j++)

        checkImage[i][zindex][0] = ZTable[j].SigLevel +  90;
        checkImage[i][zindex][1] = ZTable[j].SigLevel + 90;
        checkImage[i][zindex][2] = ZTable[j].SigLevel +50;


and then

here i am not getting colors as required. It is giving almost same.

Now i am thinking to use GL_COLOR_INDEX instead of GL_RGBA. so that we can create different colors for different range of signal strengths. But i don’t know how to create colot table and then map that one.

Can any one send me example for this one.

Thanks in advance

I think this is more a logic problem than an OpenGL problem.
Whether you are using colour indexing or straight RGB then you need to find the active range of your incoming signals and spread that over the colour resolution you have… This can be done logarithmically or on a uniformly scaled basis.

I suspect that the variations you are getting in data are only mapping to a very small part of your colour range.

If you are using floating point colour then you need to get your active range of signals coming in to match to the range 0.0 - 1.0. If you are using bytes for your colour data then you perhaps need to work with your data in floating point and either divide your active rang over 0 - 255.0f and then covert that to bytes directly, or easier map it over the 0.0 - 1.0 range and then multiply it by 255, before converting it to a byte.

wrt to the GL_COLOR_INDEX question itself, here is a thread that covers some of it :