SDL_RenderSetLogicalSize scaling behavior after renderer creation and high‑DPI hint interaction
0 reputation · 24 Apr 2021, 04:05 UTC
When developing an SDL2 application that targets a fixed logical resolution, developers often call SDL_RenderSetLogicalSize after the renderer has been created to decouple drawing coordinates from the window pixel dimensions. The documentation states that the new logical size applies to subsequent drawing operations, but it is unclear whether the function also retroactively scales or reshapes content that has already been rendered to the render target. Additionally, on high‑DPI displays the logical size may be further modified by the system scaling factor unless SDL_HINT_VIDEO_HIGHDPI is disabled, and it is not specified how this interacts with the logical size set by the function.
Understanding these interactions is important for preserving visual fidelity and ensuring that UI elements appear at the intended size across different hardware configurations.
Does SDL_RenderSetLogicalSize affect pixels already present in the render target, or only future draw calls?
When SDL_HINT_VIDEO_HIGHDPI is set to 0, does the logical size remain exactly as specified, ignoring the display’s scale factor?
If both hints are active, what is the final scaling applied to rendered output?