#12350 - Zicher - Sat Nov 08, 2003 6:00 pm
Hey all,
I'm trying to figure out some of the tutorials around here, and I'm having some trouble getting a Mode 4 piece to work. The object of the code is to display an image on the screen.
The sample code works fine, but unfortunately when I change the image even a little bit, the screen draws as if I'm "skipping" a line per x-coordinate, which makes it look like vertical interlacing lines. Let me give some examples:
This code works with the ORIGINAL image provided with the tutorial (loaded in from a header file):
Tried to clean that up for the post.. hopefully it worked. Anyway, if I use a image converting program (any, I've tried dozens), and just change out the image data in the header file, the above bug happens. Also, strangely enough, even if I change the PlotPixel line to:
for example, the bug also happens!
I do not think this has to do with the 16-bit word problem of Mode 4, as the code works with the original image.
Here is the PlotPixel function for completeness:
Oh GBA Gods, can thee help me?
I'm trying to figure out some of the tutorials around here, and I'm having some trouble getting a Mode 4 piece to work. The object of the code is to display an image on the screen.
The sample code works fine, but unfortunately when I change the image even a little bit, the screen draws as if I'm "skipping" a line per x-coordinate, which makes it look like vertical interlacing lines. Let me give some examples:
This code works with the ORIGINAL image provided with the tutorial (loaded in from a header file):
Code: |
SetMode(MODE_4 | BG2_ENABLE); for(loop = 0; loop < 256; loop++) BGPaletteMem[loop] = master_Palette[loop]; while(1) { for(y = 0; y < 160; y++) { for(x = 0; x < 120; x++) { PlotPixel(x,y, mytile_Bitmap[(y*120)+x]); } } } |
Tried to clean that up for the post.. hopefully it worked. Anyway, if I use a image converting program (any, I've tried dozens), and just change out the image data in the header file, the above bug happens. Also, strangely enough, even if I change the PlotPixel line to:
Code: |
PlotPixel(x,y, 5); |
for example, the bug also happens!
I do not think this has to do with the 16-bit word problem of Mode 4, as the code works with the original image.
Here is the PlotPixel function for completeness:
Code: |
void PlotPixel(int x,int y, unsigned short c) { VideoBuffer[(y) * 120 + (x)] = (c); } |
Oh GBA Gods, can thee help me?