Problem Setting Up Backgrounds and VRAM
Posted: Wed Feb 20, 2013 5:01 pm
I've been working on a project for nds lately and got stuck on a problem while trying to setup backgrounds.
As a starting point I tried the following setup:
> Mainscreen: Text and BMP Framebuffer
> Subscreen: BMP Framebuffer
Here is the code:
The problem is whenever I try to draw on the buffers and print text I get graphic artifacts, which from what I read is probably being caused by backgrounds sharing the same piece of VRAM memory, but I can't figure out how to properly setup my backgrounds.
I'd really appreciate if anyone could help me with this problem and maybe give some insight on how to setup Backgrounds and VRAM Banks.
Thanks in advance.
As a starting point I tried the following setup:
> Mainscreen: Text and BMP Framebuffer
> Subscreen: BMP Framebuffer
Here is the code:
Code: Select all
System::System( void )
{
videoSetMode ( MODE_5_2D );
videoSetModeSub( MODE_5_2D );
vramSetBankA( VRAM_A_MAIN_BG );
vramSetBankB( VRAM_B_MAIN_BG );
vramSetBankC( VRAM_C_SUB_BG );
consoleInit( NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 4, 0, true, true );
bgIndex = bgInit( 2, BgType_Bmp16, BgSize_B16_256x256, 5, 0 );
this->mainScreen.setFrameBuffer( ( u16 * ) bgGetGfxPtr( bgIndex ) );
bgIndex = bgInitSub( 3, BgType_Bmp16, BgSize_B16_256x256, 0, 0 );
this->subScreen.setFrameBuffer( ( u16 * ) bgGetGfxPtr( bgIndex ) );
}
I'd really appreciate if anyone could help me with this problem and maybe give some insight on how to setup Backgrounds and VRAM Banks.
Thanks in advance.