DX9 Palettised textures

Started by
3 comments, last by Naku 20 years, 11 months ago
Can anyone give me some pointers on using textures with an 8-bit palette in DX9 or 8 will probably do, its easy enough to convert. I can''t seem to find anything on them and the SDK docs barely even mention it.
APE
Advertisement
Palettes are defined as 256 entry arrays of PALETTEENTRY.

D3D supports many (16384 I think) palettes to be defined at once, but only 1 palette can be selected at a time, shared across all texture stages (grrr).

Set the palette like this:
m_pd3dDevice->SetPaletteEntries(nPaletteIndex, pPaletteData);

Tell D3D which palette is active like this:
m_pd3dDevice->SetCurrentTexturePalette(nPaletteIndex);

Warning:
On my work machine (P4 1.8, GeForce3Ti200, DX8.1, WinXP), and my home machine (Athlon 1.4, GeForce3, DX8.1, Win98SE), changing which palette is active while something is already queued to draw causes the machine to reboot. Putting in a Sleep(10) before every palette change/texture change works fine, but is obviously worthless.

Palettes work fine on XBox (you can have 1 per stage, and they don''t crash).

I use palettes solely to get 8 bit alpha masks, and grey scale images, set a single palette, and make that one palette always active. Because of a bug in either D3D or the nVidia drivers, using palettes anywhere else seems to be impossible. Random spontaneous reboots aren''t a good selling point for most games.
"Random spontaneous reboots aren''t a good selling point for most games."

They''re not? Looks like I''ll have to start my whole game concept from scratch. Actually my last program never reset my computer once, but it did reset all my friends'' computers. I''d call that a success.
hmmm, thanks. Still not working right but I think I''ll give it a miss afterall. The program crashes if I try to delete the tempory texture entries after I''ve filled the texture, everything''s just showing up white and my framerate dropped by about 200fps. I think I''ll stick to the ARGB values.
APE
Very few cards support P8 textures. Check the CAPS. I''m almost positive that current GeForce drivers don''t expose that CAP, so if you''re using them that''s a programmer error.

It''s too bad, I like P8...


Stay Casual,

Ken
Drunken Hyena
Stay Casual,KenDrunken Hyena

This topic is closed to new replies.

Advertisement