#169981 - 0xdeadbeef - Thu Aug 20, 2009 3:24 pm
I was experimenting a little with grit and had moderate success converting bitmaps for use in an NDS project. However when I started using grit for converting a bitmap to a tiled map I ran into some trouble.
The image I'm feeding grit is a 256x192 png file. I'm processing the image wth the following parameters:
I'm using the following code to copy the map, tiles and palette into their respective memory:
I've initialised the background as follows:
So I basicly call initTileMap() first followed by a call to copyTileMap. The results is garbled output on the main screen. The only peculiar thing I'm trying right now is to use only the first 32 entries in the palette, since I want to set up another background with a bitmap that will need other colors.
The other thing I'm doing is copying some bitmaps to memory every 15 frames on the subscreen, but that works and disabling those calls doesn't seem to make a difference.
Do any of you see where I'm doing something wrong?
The image I'm feeding grit is a 256x192 png file. I'm processing the image wth the following parameters:
Code: |
-gt -gB8 -ps0 -pe31 -m -mu16 -mLf -mu16 |
I'm using the following code to copy the map, tiles and palette into their respective memory:
Code: |
void copyTileMap() { const int DMA_CHANNEL = 3; DC_FlushAll(); dmaCopyHalfWords(DMA_CHANNEL, tileMap, (u16*) BG_MAP_RAM(0), tileMapLen); dmaCopyHalfWords(DMA_CHANNEL, tile, (u16*) BG_BMP_RAM(1), tileLen); dmaCopyHalfWords(DMA_CHANNEL, tilePal, BG_PALETTE, tilePalLen); } |
I've initialised the background as follows:
Code: |
void initTileMap() { videoSetMode(MODE_5_2D | DISPLAY_BG2_ACTIVE); vramSetBAnkA(VRAM_A_MAIN_BG_0x06000000); REG_BG2CNT = BG_BMP8_256x256, | BG_BMP_BASE(1) | BG_MAP_BASE(0) | BG_PRIORITY(2); REG_BG2PA = 1 << 8; REG_BG2PB = 0; REG_BG2PC = 0; REG_BG2PD = 1 << 8; } |
So I basicly call initTileMap() first followed by a call to copyTileMap. The results is garbled output on the main screen. The only peculiar thing I'm trying right now is to use only the first 32 entries in the palette, since I want to set up another background with a bitmap that will need other colors.
The other thing I'm doing is copying some bitmaps to memory every 15 frames on the subscreen, but that works and disabling those calls doesn't seem to make a difference.
Do any of you see where I'm doing something wrong?