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 > 3D on the subscreen

#119539 - krucraft - Sat Feb 24, 2007 2:48 am

Hi, I am having trouble getting my graphics on the bottom screen. I originally had my 3D on the top screen and text on the bottom screen. I tried to change everything so that my 3D is on the bottom screen and text is on the top screen. I successfully put the text on the top screen but nothing is displayed on the bottom screen.

So far my code is as follows:

Code:

   // Setup the top screen for text
   vramSetMainBanks(   VRAM_A_MAIN_SPRITE,        //A and B maped consecutivly as sprite memory
                        VRAM_B_MAIN_SPRITE,        //this gives us 256KB which is the max
                        VRAM_C_MAIN_BG_0x6000000,  //map C to background memory
                        VRAM_D_LCD                 //not using D
                        );
   videoSetMode(MODE_0_2D | DISPLAY_BG0_ACTIVE);   //bg 0 will be used to print text
   BG0_CR = BG_MAP_BASE(31);//use bg0 for the text
   BG_PALETTE[255] = RGB15(31,31,31);   //by default font will be rendered with color 255
   // set up bottom screen for 3D
   videoSetModeSub(MODE_0_3D);
   
   //consoleInit() is a lot more flexible but this gets you up and running quick
   consoleInitDefault((u16*)SCREEN_BASE_BLOCK(31), (u16*)CHAR_BASE_BLOCK(0), 16);
   



Can anyone see what I am doing wrong?

Thanks in advance.

#119541 - tepples - Sat Feb 24, 2007 2:53 am

You need to put the text on the sub screen and the 3D on the main screen, and then call lcdMainOnBottom() to put the sub screen on top.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#121883 - FRuMMaGe - Thu Mar 15, 2007 1:23 pm

tepples wrote:
You need to put the text on the sub screen and the 3D on the main screen, and then call lcdMainOnBottom() to put the sub screen on top.


You can also use lcdSwap();

#121891 - silent_code - Thu Mar 15, 2007 1:57 pm

but you should use lcdMainOnBottom(), as - in contrast to lcdSwap() - it's considered a safe method for most devices and loaders (lcdSwap() is relative, lcdMainOn...() is absolute).