Open pzoltowski opened 2 years ago
Also not sure if this is because of some mismatch between SDL on iOS and on desktop. They have some notes here: Notes -- Retina / High-DPI and window sizes
I tried also the following combo ios+sdl+opengl3 (had to force via #define IMGUI_IMPL_OPENGL_ES2 1
in imconfig.h
and add #include <OpenGLES/ES2/gl.h>
in 'example_sdl_opengl3/main.mmto make it compile), but the result it's the same - couldn't find a way to make it with high dpi enabled. I noticed official
example_apple_metal` example also has the same issue.
Has anyone found a suitable workaround for this? The same issues still occur. IMGUI+SDL2 on iOS can't cope with the high DPI setting. The issue of course being that it's a setting you need if you want a sensible looking app on iOS. (i.e. not blurred).
If anyone could give some hints I could maybe delve in deeper.
To confirm, the rendering is fine, it's just the input that's the problem.
The issue appears to be that the input XY range is perhaps connected to the rendering resolution, but with this setting it needs to be connected to the actual window size as reported by SDL.
I have been able to get it to work. In ImGui_ImplSDL2_ProcessEvent
I disabled SDL_MOUSEBUTTONDOWN and SDL_MOUSEBUTTONUP cases when running on iOS, I then wrote cases for SDL_FINGERDOWN and SDL_FINGERUP which effectively do io.AddMouseButtonEvent(0, true); and io.AddMouseButtonEvent(0, false); respectively.
This does appear to work and now I can have SDL using HIGHDPI mode on iOS (which is effectively the sensible default) and have IMGUI work correctly. No idea why it wasn't working. Hope that helped someone out there.
Version/Branch of Dear ImGui:
Version: latest from master (but v1.88 also the same issue) Branch: master
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_sdl.cpp + imgui_impl_metal.mm Compiler: buildin from Xcode 13.2.1 (MacOS 11.6 Big Sur) Operating System: iOS 15.5 (iPhone XS)
My Issue/Question:
I'm trying to make some good looking example for iOS using SDL + metal. When using 'SDL_WINDOW_ALLOW_HIGHDPI' and following FAQ re DPI, text is crispy seems properly rendered 3x but it's only rendered to smaller viewport (3x smaller), also touch input is not aligned with what is rendered (touch behaves like everything is rendered properly to fullscreen but e.g. need to slide on right edge of my iphone to scroll small rendered window).
I used slightly modified example from
examples/example_sdl_metal.mm
(just loading custom font, showing only demo window, and tried differentSDL_CreateWindow
). Used the latest SDL (2.32.2). Small modification forShowDemoWindow
below (just to render fullscreen and some offset for notch):Some investigation:
Result (screenshot 1):
Printed debug values:
if I hardcode
void ImGui_ImplSDL2_NewFrame()
to give biggerdisplay_w
anddisplay_h
:Result (screenshot 2):
if I turn off
SDL_WINDOW_ALLOW_HIGHDPI
everything is rendered fullscreen but not sharp anymore (upscaled). (screenshot 3)**Screenshot