Page 1 of 1

Palette corruption help

Posted: Wed Mar 06, 2019 1:23 pm
by Munkyears
Hi Guys!

Another noob question :)

Its my understanding that we are limited to 4 color palettes?

For some reason, Im loading different PNG's as backgrounds (TMSS, intro screen, title screen, first animation)
however when loading my foreground on PLANA and BG on PLANB, my FG seems to load perfectly however my BG sees a lot of corruption mainly in the top 8 rows?
help.png
help.png (139.97 KiB) Viewed 5406 times
The bottom is pulled from Photoshop, it is correctly indexed yet causes some weird garbled mess

Code: Select all

VDP_setPalette(PAL1,FG_image.palette);
VDP_setPalette(PAL2,BG_image.palette);
u16 ind = TILE_USERINDEX+300;
VDP_drawImageEx(PLAN_A, &BG_image, TILE_ATTR_FULL(PAL2, FALSE, FALSE, FALSE, ind), 0, 0, TRUE, TRUE);
VDP_drawImageEx(PLAN_B, &FG_image, TILE_ATTR_FULL(PAL1, FALSE, FALSE, FALSE, ind), 0, 0, TRUE, TRUE);
VDP_drawText ( " CTHULU intro",     1, 12);
waitMs(3000);
VDP_fadeOutAll(10,0);
SND_stopPlay_XGM();
Anyone see what I'm doing wrong, Im getting ready to load all the sprites etc after this but cannot figure this one out?
its almost like there is something tampering with the image as the bottom of it seems okay?

[EDIT] here it is with correct transparency added to FG, that eliminates the white issue but still have the strange garbled mess
cthulu.png
cthulu.png (236.16 KiB) Viewed 5405 times
Cheers!

Re: Palette corruption help

Posted: Fri Mar 08, 2019 6:40 pm
by Boyfinn
Can you check your vRAM? Are you running out of tiles?

Re: Palette corruption help

Posted: Fri Mar 08, 2019 10:40 pm
by Stef

Code: Select all

VDP_drawImageEx(PLAN_A, &BG_image, TILE_ATTR_FULL(PAL2, FALSE, FALSE, FALSE, ind), 0, 0, TRUE, TRUE);
VDP_drawImageEx(PLAN_B, &FG_image, TILE_ATTR_FULL(PAL1, FALSE, FALSE, FALSE, ind), 0, 0, TRUE, TRUE);
You're putting your tiles for both plan / image on same location in VRAM (from ind variable), it could not work that way.