glDrawPixels with GL_COLOR_INDEX

Hi!

I just can’t get my code working to draw anything with glDrawPixels.

Following situation: I have color index image data with GL_UNSIGNED_BYTE and want to draw the data with glDrawPixels. I have set up a color map for mapping the color indices to RGBA but without any success. Here is the relevant code:

glPixelTransferi(GL_MAP_COLOR,GL_TRUE);

GLfloat redMap[8] =   {0.,0.,1.,1.,1.,0.,0.,0.};
GLfloat greenMap[8] = {0.,1.,1.,0.,0.,0.,0.,0.};
GLfloat blueMap[8] =  {0.,0.,0.,0.,1.,0.,0.,0.};
GLfloat alphaMap[8] = {0.,1.,1.,1.,1.,0.,0.,0.};

glPixelMapfv(GL_PIXEL_MAP_I_TO_R,8,&redMap[0]);
glPixelMapfv(GL_PIXEL_MAP_I_TO_G,8,&greenMap[0]);
glPixelMapfv(GL_PIXEL_MAP_I_TO_B,8,&blueMap[0]);
glPixelMapfv(GL_PIXEL_MAP_I_TO_A,8,&alphaMap[0]);

glRasterPos2f(0.f,0.f);
glDrawPixels(wxrImage->getWidth(),wxrImage->getHeight(),GL_COLOR_INDEX,GL_UNSIGNED_BYTE,wxrImage->getImageData());   

glPixelTransferi(GL_MAP_COLOR,GL_FALSE);

WxrImage::getImageData returns const unsigned char* of size wxrImage->getWidth()*wxrImage->getHeight()

Has anyone a hint what’s wrong here? Trying the same with glTexImage2D works.

Thanks,
steve

Did you enable your pixel maps with glPixelTransferi(GL_MAP_COLOR, GL_TRUE)?

Oops, I see that you did at the top.

Whose OpenGL driver are you using?

glxinfo tells me GL version string is 1.3.5461

That means you run an NVIDIA Linux driver version 54.61?
You should try more up-to-date drivers.
http://www.nvidia.com/object/unix.html