Advertisement

Question about palettes

Started by August 26, 2000 11:44 AM
2 comments, last by dj9781 24 years, 4 months ago
If I use 16 bit color in my game to I have to worry about loading palettes?
No.
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
Advertisement
In 16, 24, and 32 bit color modes you would use an RGB calculator. For ex. (in directX) after you lock the surface you would write to it like this:

#define RGB16(r,g,b)((b%32) + ((g%64) << 5) + ((r%32) << 11))

((unsigned short *)vide_mem)[position_in_mem] =
RGB16(red,green,blue);

And you''d get a 16bit color, but you need a differant calculator for 32 and 24 bit modes

Remember that some cards use 565 mode and some use 555 modes for 16 bit, you''ve got to take that into consideration when using RGB macros.
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall

This topic is closed to new replies.

Advertisement