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 > scaling rotational background

#55873 - GPFerror - Mon Oct 03, 2005 5:39 pm

im trying to display a 320X240 bmp which is the correct way to scale it?
or if I wanted to display a 640X480 bmp.

Code:
BG3_CR = BG_BMP8_512x512;
BG3_XDX = (width<<8)/256;
BG3_YDY = (height<<8)/192;


or should it be

Code:
BG3_CR = BG_BMP8_512x512;
BG3_XDX = width;
BG3_YDY = height;


or

Code:
BG3_CR = BG_BMP8_512x512;
BG3_XDX = 512;
BG3_YDY = 512;


are any of them right? if not how should I scale it?


thanks,
Troy

#55878 - Mighty Max - Mon Oct 03, 2005 6:14 pm

My scaling code for dsmpeg:

Code:

            BG3_XDX = ((info->sequence->width / 256) << 8) | (info->sequence->width % 256) ;
            BG3_YDY = ((info->sequence->height / 192) << 8) | ((info->sequence->height % 192) + (info->sequence->height % 192) / 3) ;

_________________
GBAMP Multiboot

#55891 - GPFerror - Mon Oct 03, 2005 9:17 pm

Mighty Max wrote:
My scaling code for dsmpeg:

Code:

            BG3_XDX = ((info->sequence->width / 256) << 8) | (info->sequence->width % 256) ;
            BG3_YDY = ((info->sequence->height / 192) << 8) | ((info->sequence->height % 192) + (info->sequence->height % 192) / 3) ;


thanks ill try that out,

Just curious does the scaling code have to change if im using BG_BMP8_256X256 vs BG_BMP8_512x512 vs BG_BMP8_1024x512 ?

thanks,
Troy(GPF)

#55895 - Mighty Max - Mon Oct 03, 2005 9:34 pm

I'm running it on a 512x512 after i used it on 256x256 BGs.

As for my understanding (someone correct me if im wrong) it is simply a fixed point value of scaling against a 1to1 BG-Pixel to Screen-Pixel display.

It scales the BG by 1/(high_byte + (low_byte/256)). So that 0x0100 will be 1x scale. 0x0080 would be 2x scaling. 0x0200 1/2x scaling.
_________________
GBAMP Multiboot

#55992 - GPFerror - Wed Oct 05, 2005 6:41 am

Mighty Max wrote:
I'm running it on a 512x512 after i used it on 256x256 BGs.

As for my understanding (someone correct me if im wrong) it is simply a fixed point value of scaling against a 1to1 BG-Pixel to Screen-Pixel display.

It scales the BG by 1/(high_byte + (low_byte/256)). So that 0x0100 will be 1x scale. 0x0080 would be 2x scaling. 0x0200 1/2x scaling.


yeah its seems to work great for 512X512 backgrounds and lower, probably the BG_BMP8_1024x512 is not working due to other reasons. I posted another thread for that here
http://forum.gbadev.org/viewtopic.php?t=7041

thanks again for your help.
Troy