BG image shows up as garbage
Posted: Tue Jun 07, 2011 3:00 pm
Hello, I'm trying to extend my knowledge of programming to the nds, but I've hit a snag pretty early on.
I've followed a few tutorials and gotten them to work, but as soon as I try to make anything of my own, the background images consistently show up as garbage. The code I'm using to display my image is very simple:
the bg test image:
http://i.imgur.com/GbsIr.png
the end display:
http://i.imgur.com/fpqAX.png
any help is appreciated.
I've followed a few tutorials and gotten them to work, but as soon as I try to make anything of my own, the background images consistently show up as garbage. The code I'm using to display my image is very simple:
Code: Select all
#include <nds.h>
#include <stdio.h>
#include "bg.h"
int main(void)
{
videoSetMode(MODE_5_2D | DISPLAY_BG3_ACTIVE);
vramSetBankA(VRAM_A_MAIN_BG);
irqInit();
irqEnable(IRQ_VBLANK);
int bg3 = bgInit(3, BgType_Bmp8, BgSize_B8_256x256, 0,0);
dmaCopy(brickTiles, bgGetGfxPtr(bg3), 256*256);
dmaCopy(brickPal, BG_PALETTE, 256*2);
while(1)
{
// process logic
// process graphics
swiWaitForVBlank();
// update graphics
}
return 0;
}
http://i.imgur.com/GbsIr.png
the end display:
http://i.imgur.com/fpqAX.png
any help is appreciated.