Welcome! Log In Create A New Profile

Advanced

Clipping my screen area?

Posted by AberrantWolf 
Clipping my screen area?
September 11, 2011 05:02AM
Hey, I just started programming for Wii, er, today. So far it's going fairly well, I have a triangle in 3D space, I can move around it, and I can draw a triangle where the wiimote is pointing on screen.

I'm seeing some black bars on the left and right sides of my screen, however, that I don't see when in the Wii menu or the Homebrew Channel. I see these black bars even on the example programs provided with devkitpro.

Is there some known aspect ratio or clipping bounds issue going on with the example programs?

I can probably post photos if you really don't believe me. :P

EDIT: Oh! And I'm running widescreen, North America, HDTV (720p max).



Edited 1 time(s). Last edit at 09/11/2011 05:05AM by AberrantWolf.
Re: Clipping my screen area?
September 12, 2011 06:11AM
I was looking into this recently but sorta gave up. Some applications adjust their x-scale when the wii is set to widescreen mode (The Homebrew Channel, FZero GX, COD:WAW). I haven't seen any homebrew applications that do this trick and I don't know how it is done.
Re: Clipping my screen area?
September 12, 2011 08:01AM
The simple trick that the wii menu and HBC use is to have no (or very small) borders and a background image that doesn't have any important info near the edges. The amount of overscan (the bits at the edges of the screen that get hidden) that a TV has can vary greatly but as long as you keep important info away from the edges (so it never gets cut off) and fill it up with your background, it should look fine.
Re: Clipping my screen area?
September 12, 2011 05:04PM
From what I see in the snesGX source it maybe that they draw everything to a widescreen texture then squish the texture so that it fits into the 640x480 screen. There resulting in the Anamorphic Widescreen effect.
Re: Clipping my screen area?
September 12, 2011 10:14PM
Okay, I downloaded the Snes9x GX source, and I'll have to try some of what it looks like they're doing when I get home. But I did check the app, and it works as expected, so they must be doing something right. :P
Re: Clipping my screen area?
September 13, 2011 05:51AM
Okay, I found this code in Snes9x, and it seems to work pretty well when I set up the video mode:
rmode = VIDEO_GetPreferredMode(NULL);

// Fix to fill the whole screen width :)
if( CONF_GetAspectRatio() == CONF_ASPECT_16_9 ) {
	rmode->viWidth = 678;
} else {
	rmode->viWidth = 672;
}

if(true) { //vmode is 60hz
	rmode->viXOrigin = (VI_MAX_WIDTH_NTSC - rmode->viWidth)/2;
	rmode->viYOrigin = (VI_MAX_HEIGHT_NTSC - rmode->viHeight)/2;
}
So now you know, in case you want to do something similar in your own projects. ;)

Thanks for the tips!



Edited 1 time(s). Last edit at 09/13/2011 05:52AM by AberrantWolf.
Re: Clipping my screen area?
September 13, 2011 08:56AM
That only changes the visible area though (and not very well, you'll get borders at the top and bottom for PAL modes), it doesn't change the output aspect ratio like owen was talking about.
Re: Clipping my screen area?
September 13, 2011 09:11AM
The visible area is really what I was asking about. The example setup was generating a 640x480 framebuffer, which when stretched out by my TV (since that's how the Wii works for these sort of things) wasn't filling up left-to-right as much as it should have.

Aspect ratio is a function of width over height (or vice versa, I forget which is more standard, atm); though it occurs to me I should probably try drawing a square to make sure that it does, in fact, look square. XP

Is it possible that the default "VIDEO_GetPreferredMode(NULL)" just returns a 4:3 ratio screen all the time regardless? And is this normal, like, should I customize my aspect ratio by hand? (There are only two, so that's probably not too terrible a thing to have to do...)
Re: Clipping my screen area?
September 13, 2011 07:56PM
That's freaky, some time back I tried to find the best value myself. For 16:9 I found 678 was 'best fit' (no pun intended) for all types of TV.
Leaving non 16:9 to what ever the VIDEO_GetPreferredMode set worked well.
(the above 672 for non 16:9 will probably work very well, might just use that value myself)
Sorry, only registered users may post in this forum.

Click here to login