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.

Graphics > Mode 3 Problem.

#10381 - whells - Wed Sep 03, 2003 7:09 pm

Code:

#include "Bgd02.h" // preDefine
#include "robert16b.c" //Conver an 16-bit image(*.bmp) to .c file

//Draw
void paint()
{
   int x,y;
   for(y = 0; y < 160; y++)
   {
      for(x = 0; x < 240; x++)
      {
         VideoBuffer[(y)*240 + (x)] = robert16b_Map[(y)*240 + (x)];
      }
   }   
}

int main()
{
   SetMode( MODE_3 | BG2_ENABLE );
   paint();
}


It looks vary easy but I always get wrong output ...:q.
I just want to test MODE 3


Include Original Image
Output Image
_________________
~ GBA SP~

#10384 - niltsair - Wed Sep 03, 2003 7:39 pm

The program end and reboot, add a while(1) loop.
Code:
int main()
{
   SetMode( MODE_3 | BG2_ENABLE );
   paint();
   while(1);
}

#10394 - whells - Thu Sep 04, 2003 2:50 am

Although it still output a wrong work.

Thanks, niltsair
_________________
~ GBA SP~

#10402 - Master S - Thu Sep 04, 2003 6:55 am

Try to fill the screen with 0xffff or something to make sure that VideoBuffer points corectly. If this is the case, maby the image array aint declared as const ?

Are you sure the image is convertet to the corect format (p|RRRRR|ggggg|BBBBB) ?

#10406 - funkeejeffou - Thu Sep 04, 2003 8:27 am

Are videobuffer and robert16b_Map declared as u16 arrays?

#10479 - whells - Sat Sep 06, 2003 5:15 am

Master S wrote:
Try to fill the screen with 0xffff or something to make sure that VideoBuffer points corectly. If this is the case, maby the image array aint declared as const ?

Are you sure the image is convertet to the corect format (p|RRRRR|ggggg|BBBBB) ?


I use "AGBGFXConverter.exe" to convert the imge.

Choose Map Format : Bitmap Mode, 65536 colour
Others Defaults.

As Follows is part of my image header code.

Code:
const u16 robert15b_Map[38400] = {
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
...
0x7dff,0x3fef,0x7dff,0x3fef,0x7dff,0x3fef,0x7dff,0x3fef,
0x7dff,0x3fef,0x7dff,0x3fef,0x7dff,0x3fef,0x7dff,0x3fef,
0x7dfb,0x3aee,0x6ddb,0x3b6e,0x6dfb,0x3f6f,0x6dfb,0x3fef,
0x7dff,0x3fef,0x7de6,0x2904,0x304c,0x0581,0x302c,0x0581,


VideoBuffer and robert15b_Map were also use "u16" data type.
_________________
~ GBA SP~

#10484 - tepples - Sat Sep 06, 2003 1:55 pm

We can't easily tell what a "wrong work" is. If you could paste a screenshot of VBA, along with a mock-up of what it's supposed to look like, that would be helpful.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.