Palette corruption help

SGDK only sub forum

Moderator: Stef

Post Reply
Munkyears
Very interested
Posts: 54
Joined: Sat Mar 21, 2009 4:24 pm
Location: Sheffield, England

Palette corruption help

Post by Munkyears » Wed Mar 06, 2019 1:23 pm

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 4309 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 4308 times
Cheers!
To be this good takes ages, To be this good takes Stef, Kanedafr, ChillyWilly & everyone who has helped me discover what hardwork is!

Dive into the SpritesMind! :)

Boyfinn
Very interested
Posts: 57
Joined: Sat Aug 08, 2015 12:12 pm
Location: Lapland, Finland

Re: Palette corruption help

Post by Boyfinn » Fri Mar 08, 2019 6:40 pm

Can you check your vRAM? Are you running out of tiles?

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Palette corruption help

Post by Stef » Fri Mar 08, 2019 10:40 pm

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.

Post Reply