Hi!
I have the following situation: I have 8 bit (GL_UNSIGNED_BYTE) pixel data. The value of the pixel represents a color index. Actually there are only 4 distinct colors. The pixel data should now be used as texture. I’ve tried without any success to get the texture correctly working. It seems that my color map are not interpreted correctly. Here is my code:
glPixelTransferi(GL_MAP_COLOR,GL_TRUE);
GLushort redMap[4] = {0,255,255,0,255};
GLushort greenMap[4] = {255,0,255,255,0};
GLuschort blueMap[4] = {255,255,0,0,255};
glPixelMapusv(GL_PIXEL_MAP_I_TO_R,4,&redMap[0]);
glPixelMapusv(GL_PIXEL_MAP_I_TO_G,4,&greenMap[0]);
glPixelMapusv(GL_PIXEL_MAP_I_TO_B,4,&blueMap[0]);
glCreateTextures(1,&m_texture);
glBindTexture(GL_TEXTURE_2D,m_texture);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,width,height,0,GL_COLOR_INDEX,GL_UNSIGNED_BYTE,pixels);
Thanks for any help!
regards,
Stephan