Jump to content
  • Advertisement
Sign in to follow this  
pacifistcottage

[XNA] Cleanly up-scaling a 2d game to fullscreen?

This topic is 2543 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys. I am hoping someone can help me out, because I am having a serious problem getting my head around this issue, and I have wasted quite a few hours trying to get it right, but have only reached partial solutions.

Basically, the goal is this: my game's display resolution is locked at 720p. It is a 2d platformer that is heavy on exploration, so I want to make sure the amount of actual content being displayed never changes, even on monitors with different resolutions.

Now, I can get the game to scale fine when it runs in windowed mode. Basically, I am doing the route of:

(in the Draw() method)
1. create a 720p RenderTarget2d, and set it as the render target
2. draw everything to the render target
3. set render target back to null
4. draw everything to screen using an appropriate scale Matrix

Like I said, this works fine for both scaling up and down (using SamplerState.PointClamp for scaling up, and SamplerState.LinearClamp for scaling down), and the results are a pretty clean scale.

However, the issue comes into play when I try to go to fullscreen. The image gets displayed in fullscreen, but it seems like XNA is just blindly stretching it, rather than using the clean interpolation methods that it does when I run it windowed.

So what I am missing here? What do I need to do to get my 720p-locked game to scale up cleanly without actually changing the back buffer's resolution (obviously, changing the actual game's resolution to 1080p will cause problems for people who don't have top-of-line graphics cards)?

Two good examples of this right off the top of my head are Cave Story+ and Jamestown. They both have low resolutions (1024x960 & 1024x640, I believe), but can scale almost perfectly cleanly to a 1080p monitor in fullscreen mode.

For what it's worth, I recognize that my knowledge on this subject is pretty weak. I also know that I should be focusing on developing the game itself instead of worrying about this, but I have sunk so much time into at this point, I feel the need to redeem myself and get it finished. I just have not been able to find any satisfactory answers to this question yet, so if anyone is able to provide any insight, I would be eternally grateful.


edit: to give a more clear example, let me try this. If I set PreferredBackBufferWidth/Height to 1408x792 (i.e. 720p + 10%), and then pass in a scaleMatrix of 1.1f, everything displays perfectly and cleanly--it still only shows my 720 camera's display area, but it is scaled up and looks nice. I can even go super-low (this is just for testing sake, obviously), like 640x360, and set the scaleMatrix to .5f, and again, aside from being super-tiny, it looks really good and has the exact same display area. But going in to fullscreen at 720p does not properly scale it--it fills the screen, but it just looks like crap, even when the target monitor has the same display ratio.

Share this post


Link to post
Share on other sites
Advertisement
XNA doesn't do any scaling...it's all done by the display. You simply pick a fullscreen display mode out of the list of the display's supported modes (the device manager tries to do this for you based on your preferred backbuffer size), you render at that resolution, and then the display will somehow stretch it to its actual native resolution. So it might just stretch it, it might use black bars...it depends on the display.

The only way to have full control over how your game gets displayed is pick the display's native resolution, and manually scale your game to that res.

Share this post


Link to post
Share on other sites

The only way to have full control over how your game gets displayed is pick the display's native resolution, and manually scale your game to that res.


Yeah, I thought that was the case, but I wanted to make sure I wasn't missing anything. And truth be told, if I simply set the game's resolution to 1080p, it scales up fine on my monitor, and solves this problem. But then, the frame rate drops so much that the game is nearly unplayable.

So is there anything else I can do? I want to have my 720p-sized game area displayed in fullscreen in native res without killing performance. Or do I just need to accept the "stretched" look?

As I mentioned in my first post, I am intrigued by Jamestown, because it has quite a bit going on graphically but still manages to run smoothly and look perfectly clean on my 1080p monitor, even though it is running at a pretty low resolution (and does not give you any resolution options). I feel like I am still missing some obvious part of this...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!