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