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 > Graphics Problems

#103220 - TheWopr - Wed Sep 20, 2006 2:24 am

I'm just beginning my long trek as a DS programmer and i've been working through the drunkencoders examples that come packaged with Devkitpro. To keep this short, i'm having problems displaying images. This is what i did in order of which i did it.

1)Used Usenti to open my image (256 by 192)
2)Clicked export and exported it as a .bin file with 16bpp
3)Moved the .bin file to the build folder
4)Compiled with make and ran

Here is what i got when i emulated it using no$gba....

[Images not permitted - Click here to view it]

This is what it should have looked like.....

[Images not permitted - Click here to view it]

I know that it will get distorted some when i resized it to 256x192 but i don't see where the red garbled stuff at the bottom came from. Help would be awesome.

#103224 - tepples - Wed Sep 20, 2006 2:44 am

Perhaps the red garbled stuff comes from what was in VRAM before your program ran. Have you tried clearing out the entire VRAM bank?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#103245 - PypeBros - Wed Sep 20, 2006 7:48 am

sounds to me that your image is not 256x192 but more something like 256x180 ... If you still try to copy 192 rows, you'll have whatever was after your image (your code?) being displayed aswell :P
_________________
SEDS: Sprite Edition on DS :: modplayer

#103321 - TheWopr - Wed Sep 20, 2006 11:01 pm

Thanks for the replies, i fixed the problem and i'll explain what was wrong for anyone who's reading this. As tepples says, its related to the VRAM. The problem was that i had a 256x192 image, but in the skeleton code i was using when it displayed it it was translating it on a 256x256 map. By using my image with a different height it wasn't centered. I just redid the math used in the centering translation and it worked. I guess the garbled image at the bottom was the data that as in the VRAM bank before.

Problem solved but out of curiosity...just in case i ever need to, how would one flush the VRAM banks? Or did you mean just writing all them all to RGB15(0,0,0)?

#103362 - PypeBros - Thu Sep 21, 2006 9:37 am

filling with RGB(0,0,0) could be an option, and you could also just fill it with any value where the "alpha" bit is disabled (zero, iirc). That means to the hardware "ignore the value, show the layer behind".

btw, while you might have garbage values on the screen on real hardware, an emulator usually gives you pre-zeroed area, so if you see garbage on the emulator, chances are you're the one who put garbage there -- which is likely to be the case if you copy more than the actual image on the screen...

or it might not be "garbage" but e.g. character data for the console font :P
_________________
SEDS: Sprite Edition on DS :: modplayer