Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emscripten window size incorrect after screen rotation #11209

Open
slouken opened this issue Oct 14, 2024 · 0 comments
Open

Emscripten window size incorrect after screen rotation #11209

slouken opened this issue Oct 14, 2024 · 0 comments
Milestone

Comments

@slouken
Copy link
Collaborator

slouken commented Oct 14, 2024

When running on Android using Emscripten, the SDL window size is incorrect after rotating from landscape to portrait.

imbenji — Today at 6:21 AM
I've ran into this as well, you're going to need to get the window size differently on the web for use in your viewport. Here's what I've done in the past:

#ifdef __EMSCRIPTEN__
    EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context = emscripten_webgl_get_current_context();
    emscripten_webgl_get_drawing_buffer_size(context, width, height);
#else
    SDL_GetWindowSizeInPixels(window, width, height);
#endif

VigliettaSensei — Today at 9:59 AM
Anyway, the phrasing is misleading, because it's not necessarily "after rotating from landscape to portrait". It's happening in portrait mode, period.
Also, the reported solution doesn't fix the issue on some phone models. I still don't know what's causing it and why some models work and some don't.
Also, it is critical to point out that it only occurs in high dpi mode.

VigliettaSensei — Today at 10:19 AM
And remarkably it's not only model-dependent, but also browser-dependent, with Firefox being the most reliable.

@slouken slouken added this to the 3.2.0 milestone Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant