gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Palletted Textures...

#51975 - blaisef01 - Thu Aug 25, 2005 5:50 am

Does anyone have any code or a brief explanation on how to use palletted textures?
And is it possible to swap to use the same image data with multiple palettes in real time without having to load the image data into vram multiple times?

Cheers.

#52023 - duencil - Thu Aug 25, 2005 4:35 pm

I assume you're talking about palettes for 3d textures. Palettes exist in video memory just like textures. Following the conventions of ndslib, we upload them to bank VRAM_E. I have not tried but I imagine you can modify existing palettes in real time without much of a performance hit.

You can establish the location of the current palette by writing to 0x040004AC. The value you write here describes an offset from the beginning of palette memory (in our case VRAM_E), and is shifted such that an increment of 1 in the value written represents an offset of 16 bytes, which is the smallest palette block possible.

There is btw a texture format that just requires this minimum size 16 byte palette, though we don’t have the define in ndslib yet, and corresponds to 8 colours, and 32 levels of transparency. Typically though you would be using 256 colour palettes, and 8 bit texures.

I don't know if ndslib has completed support for palettes yet. When I last looked it required some changes to get this working.

#52043 - blaisef01 - Thu Aug 25, 2005 9:28 pm

Cheers mate, at least this will get me started...