![]() |
[SDL2]-SDL_RenderSetLogicalSize-Disable Letterboxing? | ![]() |
![]() |
Re: [SDL2]-SDL_RenderSetLogicalSize-Disable Letterboxing? | ![]() |
JeZ-l-Lee
![]() |
![]() |
There is no way to disable letterboxing when using SDL_RenderSetLogicalSize() ? I need the above function to fill entire window whether resized or maximized. I figured out a way to scale image and text textures to fill the window even if resized but the text outline does not look right. There must be a way? Thanks! |
||||||||||||
|
![]() |
[SDL2]-SDL_RenderSetLogicalSize-Disable Letterboxing? | ![]() |
Ryan C. Gordon
Guest
![]() |
![]() |
You'd have to specify a logical size with the same aspect ratio as the display. Otherwise, we have to letterbox it to make it work as requested. If the aspect ratio matches, we'll use the whole display without letterboxing. --ryan. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||||
|
![]() |
![]() |
JeZ-l-Lee
![]() |
![]() |
Hi,
Here is my sprite drawing function(scales properly with window resize):
Here is my text drawing function(outline does not look correct when window is resized):
No ability to turn off letterboxing makes me have to use above solution. I'll hit the text drawing function with a hammer some more and see if I can fix the outline problem on window resize. Thanks! |
||||||||||||||
|
![]() |
[SDL2]-SDL_RenderSetLogicalSize-Disable Letterboxing? | ![]() |
neoaggelos
![]() |
![]() |
Even though I haven't test it, you could try to reset the viewport everytime you get a resize event. PS. a sarcastic thank you for flooding the mailing list with almost 100-150 lines of code -- you made my day
C is the God's Programming Language |
||||||||||
|
![]() |
[SDL2]-SDL_RenderSetLogicalSize-Disable Letterboxing? | ![]() |
Ryan C. Gordon
Guest
![]() |
![]() |
Ok, the problem is that if we didn't letterbox, then the game written to run at 640x480 is going to distort if we use a whole 1920x1200 display. You have a few options: - Don't use the logical size API, and render at the full size of the window. - Force the window to be a certain aspect ratio (don't let the user resize it by dragging the window frame, give a list of resolutions they can use, that match the monitor's aspect ratio, in a menu somewhere). - Use the logical size API, and adjust your rendering to take aspect ratio into account. In a perfect world, Option #1 is your best choice, but it takes more work. The logical size API is meant to say "I absolutely need a grid of WxH pixels, my game can't function in any other way, can you figure out how to make this work right?" ...it's absolutely a lifesaver in moderning older games, but if you're doing new code, consider if you shouldn't just take advantage of all available pixels. Anyhow, those are the options as I see them. That being said (and having not examined your code), the problem you're having doesn't sound like the letterboxing, but rather the some part of the rendering...scaling _shouldn't_ affect some piece of the rendering and not others, so there's probably a bug somewhere (either in SDL or your app). --ryan. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||||
|
![]() |
[SDL2]-SDL_RenderSetLogicalSize-Disable Letterboxing? | ![]() |
gabomdq
![]() |
![]() |
2013/8/16 Ryan C. Gordon
You can also probably solve this by using Render Targets. If you are fixed on 640x480 (you shouldn't, but who knows...), you can render everything to a 640x480 texture (a back buffer of sorts), and when you want to show this to the screen you SDL_RenderCopy a cropped version of it to the full screen (sort of like "flipping" the texture to the front). -- Gabriel. |
||||||||||||||
|
![]() |
[SDL2]-SDL_RenderSetLogicalSize-Disable Letterboxing? | ![]() |
Mason Wheeler
Guest
![]() |
![]() |
I figure I ought to weigh in on this, since I came up with the basic idea of the API and pushed to get it included. And what's in SDL right now is a big, complicated mess that looks very different from what I originally set up.
The idea behind a logical size is that no matter what size the SDL_Window is, you have a consistent-sized array of pixels to render to that will fill that entire window. (This does mean stretching to fit, if necessary.) I originally implemented it with a simple call to glOrtho. What's in there now takes the idea I had and adds all sorts of complications that get in the way more than they help, such as letterboxing and the addition of scaling constants behind the scenes. The scaling really bugs me; it means that the coordinate system I'm drawing into in SDL is different from the one I'm drawing into if I use OpenGL calls directly! And since I'm doing about 98% of my rendering with SDL, but I also have some important things to draw that are too complex for the render API, that makes problems for me. SDL_RenderSetLogicalSize really should simply set the number of drawable pixels in the window equal to the value you passed in, and leave it at that. Can we fix the current broken implementation please? Mason From: Ryan C. Gordon To: Sent: Friday, August 16, 2013 11:59 AM Subject: Re: [SDL] [SDL2]-SDL_RenderSetLogicalSize-Disable Letterboxing?
Ok, the problem is that if we didn't letterbox, then the game written to run at 640x480 is going to distort if we use a whole 1920x1200 display. You have a few options: - Don't use the logical size API, and render at the full size of the window. - Force the window to be a certain aspect ratio (don't let the user resize it by dragging the window frame, give a list of resolutions they can use, that match the monitor's aspect ratio, in a menu somewhere). - Use the logical size API, and adjust your rendering to take aspect ratio into account. In a perfect world, Option #1 is your best choice, but it takes more work. The logical size API is meant to say "I absolutely need a grid of WxH pixels, my game can't function in any other way, can you figure out how to make this work right?" ...it's absolutely a lifesaver in moderning older games, but if you're doing new code, consider if you shouldn't just take advantage of all available pixels. Anyhow, those are the options as I see them. That being said (and having not examined your code), the problem you're having doesn't sound like the letterboxing, but rather the some part of the rendering...scaling _shouldn't_ affect some piece of the rendering and not others, so there's probably a bug somewhere (either in SDL or your app). --ryan. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||||
|