Question about SDL_RenderGetLogicalSize

What happens if SDL_RenderGetLogicalSize is called on a renderer on which
an SDL_RenderSetLogicalSize was never called? What will it return?

It should return the actual size of the window.? But the LogicalSize API is currently badly broken on a conceptual level, and unfortunately won’t be fixed until the next major revision.? It’s better to avoid using it at the moment; instead just render everything to a render target of the appropriate size and render that to the screen.

MasonOn Saturday, March 1, 2014 2:58 PM, Ivan Rubinson wrote:

What happens if SDL_RenderGetLogicalSize is called on a renderer on which an SDL_RenderSetLogicalSize was never called? What will it return?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

A render target is certainly also an option, but
SDL_RenderSetLogicalSize() isn’t broken, and is often easier to use.

–ryan.On 3/1/14, 11:50 PM, Mason Wheeler wrote:

It should return the actual size of the window. But the LogicalSize API
is currently badly broken on a conceptual level, and unfortunately won’t
be fixed until the next major revision. It’s better to avoid using it
at the moment; instead just render everything to a render target of the
appropriate size and render that to the screen.

Sigh.? We’ve been over this before.

Logical Size is supposed to do exactly one thing: create a virtual, arbitrary screen size to render to, which is different from the pixel size of the SDL_Window and is mapped onto it properly.? I can say that with authority because I created the original concept of the API, and furthermore I designed it to mimic the Logical Size property from another rendering system that I used to use but switched over to SDL from it for unrelated reasons.

Unfortunately, the final concept that made it into SDL 2 was implemented by someone who did not understand this, and added extra, mandatory functionality that optimizes for a very specific corner case at the expense of the general case: letterboxing and a forced maintaining of the original window’s aspect ratio.? Both of these can easily be implemented on top of true Logical Sizing, but it’s much more difficult to implement unrestricted Logical Sizing on top of this mess.? Unfortunately I didn’t catch this in time, and by the time I noticed what had been done and raised the issue on here, SDL 2 had already been released.

Sam acknowledged that this would need to be fixed, but it can’t be fixed until a future API revision because now that it’s officially released there might maybe be someone somewhere whose code is relying on the broken behavior.

On a completely unrelated note, are there any plans yet to start working on the next API revision version? :wink:

MasonOn Saturday, March 1, 2014 10:20 PM, Ryan C. Gordon wrote:

On 3/1/14, 11:50 PM, Mason Wheeler wrote:

It should return the actual size of the window.? But the LogicalSize API
is currently badly broken on a conceptual level, and unfortunately won’t
be fixed until the next major revision.? It’s better to avoid using it
at the moment; instead just render everything to a render target of the
appropriate size and render that to the screen.

A render target is certainly also an option, but
SDL_RenderSetLogicalSize() isn’t broken, and is often easier to use.

–ryan.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Sigh. We’ve been over this before.

Yes we have. And the final result of the discussion was:

  • The current API isn’t going to change.
  • We’ll still accept a patch that adds a hint to disable the
    letterboxing, or even a whole other function that does what you want if
    that’s insufficient.

The API changed from what you originally wanted. It turns out that your
personal use-case wasn’t what won out. I understand that it’s
frustrating to feel ownership in something that ends up going in a
different direction, but that’s how software evolves.

It’s happened to me on open source projects, it’s happened to me on APIs
I’ve designed for SDL, and it’ll happen to me again. Turns out, none of
us really own any of these ideas.

Telling people it’s “badly broken on the conceptual level” and not to
use it is neither accurate nor helpful. Also, being badly broken for
your concept is not the same as being badly broken in general; we went a
different direction with the idea, and the end result is amazing for
getting legacy games up and running at higher resolutions easily, which
is an extremely desirable feature for SDL. You should be proud of your
contribution to that.

On a completely unrelated note, are there any plans yet to start working
on the next API revision version? :wink:

If you call it something other than SDL_RenderSetLogicalSize, work
starts today.

–ryan.On 3/2/14, 8:38 AM, Mason Wheeler wrote:

Mason said: "It should return the actual size of the window."
However, on Windows 7 x64 under Visual Studio 2013 Express, calling
SDL_RenderGetLogicalSize on a renderer that hasn’t been
SDL_RenderSetLogicalSize’d returns width=0 and height=0!
Well isn’t that odd.On 2 March 2014 17:34, Ryan C. Gordon wrote:

On 3/2/14, 8:38 AM, Mason Wheeler wrote:

Sigh. We’ve been over this before.

Yes we have. And the final result of the discussion was:

  • The current API isn’t going to change.
  • We’ll still accept a patch that adds a hint to disable the letterboxing,
    or even a whole other function that does what you want if that’s
    insufficient.

The API changed from what you originally wanted. It turns out that your
personal use-case wasn’t what won out. I understand that it’s frustrating
to feel ownership in something that ends up going in a different direction,
but that’s how software evolves.

It’s happened to me on open source projects, it’s happened to me on APIs
I’ve designed for SDL, and it’ll happen to me again. Turns out, none of us
really own any of these ideas.

Telling people it’s “badly broken on the conceptual level” and not to use
it is neither accurate nor helpful. Also, being badly broken for your
concept is not the same as being badly broken in general; we went a
different direction with the idea, and the end result is amazing for
getting legacy games up and running at higher resolutions easily, which is
an extremely desirable feature for SDL. You should be proud of your
contribution to that.

On a completely unrelated note, are there any plans yet to start working

on the next API revision version? :wink:

If you call it something other than SDL_RenderSetLogicalSize, work starts
today.

–ryan.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Sigh.? We’ve been over this before.

Yes we have. And the final result of the discussion was:

  • The current API isn’t going to change.
  • We’ll still accept a patch that adds a hint to disable the
    letterboxing, or even a whole other function that does what you want if
    that’s insufficient.

That was not the final result.? I was quite sure of that, and I went digging around in the archives of that discussion, and found something a bit unfortunate.? The message in which Sam sent me the following was sent to me, not to the entire list.? I hadn’t noticed (my email client filters everything with [SDL] in the subject to the same folder) so I was under the impression that everyone was on the same page here. But apparently not.? So just to be clear:

Thanks, I appreciate it.

There isn’t anything wrong with your design goal, it’s just that when Ryan
and I started using it to solve our problems we needed something
different
and didn’t communicate that well with you. ?There isn’t
anything we can do
about this now, until an API rev in 2.1, aside from
adding a hint to change
the behavior. ?In 2.1 I’d like to split out the
functionality the way you described.

Cheers,
–Sam

Telling people it’s “badly broken on the conceptual level” and not to
use it is neither accurate nor helpful.

It’s accurate when I introduced the concept.? That’s what “on a conceptual
level” means: it does not do what it was intended (conceptualized) to do.

Also, being badly broken for your concept is not the same as being
badly broken in general; we went a? different direction with the idea,
and the end result is amazing for? getting legacy games up and
running at higher resolutions easily, which? is an extremely desirable
feature for SDL. You should be proud of your contribution to that.

I would be if that’s what I had intended to do, but what came out wasn’t
what I contributed.? If it’s supposed to make legacy games run well in
fullscreen, it really should have the world “fullscreen” somewhere in the
name to make it clear that that’s what’s intended.

On a completely unrelated note, are there any plans yet to start working
on the next API revision version? :wink:

If you call it
something other than SDL_RenderSetLogicalSize, work
starts today.

That introduces three serious problems.

First, the second of the proverbial Two Difficult Problems In Computer Science: what should it be called when
the proper name is already taken and does something else?

Second, adding a new API won’t get rid of the magical scaling, which is a deal-breaker for my code and a bad idea in general.

And third, adding a new API that does something similar to an existing API but subtly different will introduce all sorts of potential bugs if the two interact somehow, because they’ll necessarily have to share a
lot of implementation space.? What happens if someone tries to use both?

Mason>On Sunday, March 2, 2014 7:35 AM, Ryan C. Gordon wrote:

On 3/2/14, 8:38 AM, Mason Wheeler wrote:
On Sunday, November 10, 2013 10:35 AM, Sam Lantinga wrote:

That sounds like a bug, I’ll take a look.

–ryan.On 3/2/14, 11:46 AM, Ivan Rubinson wrote:

Mason said: "It should return the actual size of the window."
However, on Windows 7 x64 under Visual Studio 2013 Express, calling
SDL_RenderGetLogicalSize on a renderer that hasn’t been
SDL_RenderSetLogicalSize’d returns width=0 and height=0!
Well isn’t that odd.

Telling people it’s “badly broken on the conceptual level” and not to
use it is neither accurate nor helpful.

It’s accurate when I introduced the concept.

It’s clear that I’m not going to convince that this right here is the
real hurdle I’d like you to overcome, so I’ll stop exasperating you by
repeating myself.

–ryan.

This is not “a hurdle to get past.”? It’s the fundamental crux of the matter.

I created something for general use.? You appropriated it for your little pet feature, making it work really well for one minor, ridiculously specific corner case, at the expense of being useless to anyone who’s not using it for fullscreen, breaking the existing code it was intended to support, and breaking a basic symmetry that had otherwise always existed between SDL rendering and raw API rendering, and when it’s brought up you don’t seem to think any of that is any big deal and you think it’s something to be proud of!? And when I just don’t seem to get how awesome it is that you destroyed all this working code, you act like I’m the one with a problem and I just can’t get past this little hurdle.

This is not a little hurdle.? I believe I’ve used this analogy before, but this is like creating a car that goes really fast but with the engineering tradeoff that the wheels don’t turn to the right, and then thinking there’s something wrong with people who point out that you produced a defective car, because you had NASCAR drivers in mind when you created it and obviously that’s great for them.

MasonOn Sunday, March 2, 2014 10:11 AM, Ryan C. Gordon wrote:

? > Telling people it’s “badly broken on the conceptual level” and not to
? > use it is neither accurate nor helpful.

It’s accurate when I introduced the concept.

It’s clear that I’m not going to convince that this right here is the
real hurdle I’d like you to overcome, so I’ll stop exasperating you by
repeating myself.

–ryan.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I looked into this. It’s intentionally setting it to w=0,h=0 when a
logical size isn’t set, because the logical size is meant to stay
consistent even when a window resizes, so it’s wouldn’t make sense to
have it vary when disabled. Instead, w=0,h=0 means “logical sizing isn’t
currently in effect.”

That isn’t well-documented, I’ll correct that when I get a moment.

–ryan.On 3/2/14, 12:58 PM, Ryan C. Gordon wrote:

On 3/2/14, 11:46 AM, Ivan Rubinson wrote:

Mason said: "It should return the actual size of the window."
However, on Windows 7 x64 under Visual Studio 2013 Express, calling
SDL_RenderGetLogicalSize on a renderer that hasn’t been
SDL_RenderSetLogicalSize’d returns width=0 and height=0!
Well isn’t that odd.

That sounds like a bug, I’ll take a look.