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 > 2D over 3D

#169917 - Echo49 - Fri Aug 14, 2009 5:01 am

I'm having trouble displaying 2D sprites on top of the 3D scene. I tried searching, but the search doesn't seem to work (get no results whatever I search). Does anyone know how to set up the background layers (priority?) or where I can look for more information?

#169918 - Mighty Max - Fri Aug 14, 2009 7:09 am

Check http://nocash.emubase.de/gbatek.htm#lcdiobgcontrol

The priority are the first two bits in the background control.
_________________
GBAMP Multiboot

#169919 - Echo49 - Fri Aug 14, 2009 7:17 am

Code:
videoSetMode(MODE_0_3D);

vramSetBankA(VRAM_A_TEXTURE);
vramSetBankE(VRAM_E_TEX_PALETTE);

glInit();

/* etc */

videoSetBankC(VRAM_C_MAIN_BG);
PrintConsole* console = consoleInit(NULL, 3, BgType_Text4bpp, BgSize_T_256x256, 31, 0, true, true); // copied from example

// only priority bits affect 3D layer
REG_BG0CNT = 3;

bgSetPriority(console->bgId, 0);

Is there anything wrong with this? printf() doesn't show anything on top of the 3D layer.

#169921 - Min - Fri Aug 14, 2009 10:35 am

Shouldn't it be vramSetBankC instead of videoSetBankC? ;P

Anyway, I think since vramSetBankC(VRAM_C_MAIN_BG) will map to 0x06040000 you need to make sure the console tilemap and tileset are correctly offset. Or you could try vramSetBankC(VRAM_C_MAIN_BG_0x06000000).

#169922 - Echo49 - Fri Aug 14, 2009 12:02 pm

Thanks, the offset was the problem.

Quote:
Shouldn't it be vramSetBankC instead of videoSetBankC? ;P

whoops, should learn to copy paste source code ^^;