Advertisement

palette???

Started by March 29, 2002 02:02 PM
1 comment, last by glDino 22 years, 11 months ago
I noticed that some OpenGL apps create a palette when the window is initialized, like this (taken from "OpenGL Game Programming"): LOGPALETTE *pPal; HPALETTE hPalette; hPalette = CreatePalette(pPal); ... RealizePalette(hDC); What is this and why is it done??? I am using a Voodoo5, and any programs that create a palette like this run *extremely* slowly in fullscreen mode, and everything is dark blue!! Any comments? thanks.
Back in the days of DOS and no hardware acceleration, palettized modes were used. Basically, a palette maps 'indices' to 'colors'. Then you can define an image (either bitmap or screen contents) using indices rather than colors. In 256-color mode, one index takes one byte but one color needs three bytes. Therefore, you only need one-third memory to store an image.

There are many problems with palettes: they are hard to use -- you only have certain colors available. When you have two images that use different palettes and you want them both on screen at the same time, you're in trouble. Ans so on.

I think today PC programs don't use palettes at all. Hardware is optimized for 32-bit color modes, not 8-bit.


[edited by - IndirectX on March 29, 2002 11:25:52 PM]
---visit #directxdev on afternet <- not just for directx, despite the name
Advertisement
I had a feeling it was for compatibility with 256 color displays. It seems that I shouldn''t even bother to implement it at all... thanks, IndirectX.

This topic is closed to new replies.

Advertisement