SFML community forums

Help => General => Topic started by: flashrocket on April 19, 2015, 02:35:03 pm

Title: Supporting multiple resolutions
Post by: flashrocket on April 19, 2015, 02:35:03 pm
Hello, I'm tying to write a game and I found problem.Supporting multiple resolutions.
I created an implementation but it had a problem.
I created a small sized sf::View(800x600) and scaled it into a large screen(1366x768)
But during the up scaling I noticed that drawable objects such as sf::CircleShape were crisp while sf::Text was pixelated.
(click to show/hide)
If this is a good implementation then
Title: Re: Supporting multiple resolutions
Post by: zsbzsb on April 19, 2015, 03:12:30 pm
Quote
Why does this happen?

Because sf::Text is drawn using textures, and when textures are scaled unless some magical data is added to the texture the limited information available must be scaled up. Shapes on the other hand are drawn using vertices and the GPU is responsible for filling in the pixels between the points thus no scaling is required.

Quote
How do I fix it?

You are scaling a texture, do the fix for not scaling a texture.

(click to show/hide)
Title: Re: Supporting multiple resolutions
Post by: flashrocket on April 19, 2015, 03:37:02 pm
Quote
(click to show/hide)
Do you mean to say
Is there any alternate method of supporting multi-resolution.
Title: Re: Supporting multiple resolutions
Post by: Jesper Juhl on April 19, 2015, 03:44:38 pm
The options I can think of are:

 You can scale things.

 You can have pre-created images for different resolutions.

 You can use vector graphics that are effectively resolution independent.

 You can keep your images at one resolution and letterbox when resolution goes up.

I can't really think of other possibilities atm, but please prove me wrong and add some more ;-)
Title: Re: Supporting multiple resolutions
Post by: flashrocket on April 19, 2015, 04:14:44 pm
Quote
You can scale things.
Can you please be more specific. Upscaling? Downscaling? Scale What?(Views or textures)

Quote
You can use vector graphics that are effectively resolution independent.
I'm trying to use fonts(truetype) I think they are vector(https://msdn.microsoft.com/en-us/library/windows/desktop/dd162893(v=vs.85).aspx (https://msdn.microsoft.com/en-us/library/windows/desktop/dd162893(v=vs.85).aspx)) Is there some other way?
I thought SVG wasn't supported in SFML?

Quote
You can keep your images at one resolution and letterbox when resolution goes up.
What's a letterbox?
Title: Re: Supporting multiple resolutions
Post by: flashrocket on April 19, 2015, 04:36:26 pm
After tinkering around I found that setting view to (something)x768 using similar code as below to be useful in resolutions varying from 800x600 to 1366x768
(click to show/hide)

Please do suggest a better solution than this.