system
August 6, 2001, 3:59pm
1
Does someone have some code to show me how to set the palette when using this function:
glDrawPixels(BitmapInfo->bmiHeader.biWidth, BitmapInfo->bmiHeader.biHeight, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, BitmapBits);
It works when i use GL_LUMINANCE as Color format but that only shows grayscale… so help me with this please
system
August 7, 2001, 5:33am
2
I think that the palette functions is part of the OS. Perhaps somw wgl or GDI functions on Windows?
system
August 7, 2001, 8:06am
3
Nope its not OS specific… I though this was an easy question to answer?.. Should i post in the advanced forum to get an good reply or what?
system
August 7, 2001, 10:41am
4
If you think you know why do you ask?
From a OpenGL book
“OpenGL does not have any routines to load values into the color-lookup table. Window systems typically already have such operations.”
You can read the documentation yourself.
Remember that nobody have to give you a good or any kind of reply.
system
August 7, 2001, 11:08am
5
Well maybe i dont want to load a palette…
All i want to know is how to attach a palette to a glDrawPixels operation!
system
August 7, 2001, 12:47pm
6
Nevermind i fixed it somehow…
Heres the code if anyone wondered what i was actually doing…
int i;
for(i=0;i<256; i++)
{
red[i] = BitmapInfo->bmiColors[i].rgbRed<<8;
green[i] = BitmapInfo->bmiColors[i].rgbGreen<<8;
blue[i] = BitmapInfo->bmiColors[i].rgbBlue<<8;
}
glPixelTransferi(GL_MAP_COLOR, TRUE);
glPixelMapusv(GL_PIXEL_MAP_I_TO_R, 256,(const unsigned short *)&red );
glPixelMapusv(GL_PIXEL_MAP_I_TO_G, 256, (const unsigned short *)&green);
glPixelMapusv(GL_PIXEL_MAP_I_TO_B, 256, (const unsigned short *)&blue);
glDrawPixels(BitmapInfo->bmiHeader.biWidth,
BitmapInfo->bmiHeader.biHeight,
GL_COLOR_INDEX, GL_UNSIGNED_BYTE, BitmapBits);
Now its working fine!