-
-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Open
Description
Version/Branch of Dear ImGui:
Version 1.91.6, Branch: XXX master
Back-ends:
imgui_impl_sdl2.cpp + imgui_impl_sdlrenderer2.cpp + imgui_impl_sdl3.cpp + imgui_impl_sdlrenderer3.cpp
Compiler, OS:
Windows 11 + MSVC2022
Full config/build information:
Dear ImGui 1.91.6 (19160)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: _WIN32
define: _WIN64
define: _MSC_VER=1941
define: _MSVC_LANG=201402
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_sdl2
io.BackendRendererName: imgui_impl_sdlrenderer2
io.ConfigFlags: 0x00000001
NavEnableKeyboard
io.ConfigViewportsNoDecoration
io.ConfigNavCaptureKeyboard
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00000C0E
HasMouseCursors
HasSetMousePos
PlatformHasViewports
HasMouseHoveredViewport
RendererHasVtxOffset
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,128
io.DisplaySize: 1445.00,1083.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00
Details:
Both SDL2 and SDL3 allow a fixed logical resolution for rendering, regardless of the actual output resolution. For more information, please see https://wiki.libsdl.org/SDL3/SDL_SetRenderLogicalPresentation.
Currently, if the renderer uses logcal coordinates, imgui behavior is broken:
- UI is rendered to logical resolution and then scaled to window coordinates. I believe it should use window coordinates regardless of logical resolution.
- Mouse coordinates are off
As a workaround, I reset logical resolution before calling imgui frame and set it back after. Also I use SDL_RenderLogicalToWindow to convert mouse coordinates before sending them to imgui backend.
Maybe it's worth adding as a part of the library? Current behavior doesn't look good...
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
Reactions are currently unavailable