Archived

This topic is now archived and is closed to further replies.

DX9 Palettised textures

This topic is 5338 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
"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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites