| Summary: | Android: SDL_GL_GetDrawableSize returns wrong size | ||
|---|---|---|---|
| Product: | SDL | Reporter: | dmuratshin <frankinshtein85> |
| Component: | video | Assignee: | Sylvain <sylvain.becker> |
| Status: | WAITING --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | CC: | sezeroz, someuniquename |
| Version: | HG 2.1 | ||
| Hardware: | Other | ||
| OS: | Android (All) | ||
| Attachments: | logcat | ||
|
Description
dmuratshin
2018-09-09 14:22:28 UTC
I looked up the three commits you referenced and could not find any of them in hg repository. Created attachment 3302 [details]
logcat
sorry, hash values are taken from SDL mirror on github, example: https://github.com/spurious/SDL-mirror/commit/411f83f9a04d6cc8ac55037f285651f3f41fee18 UPDATE: I attached log file with logged everything including SDL_GL_GetDrawableSize. error was reproduced on Amazon Kindle with real display resolution 1024x600, but SDL_GL_GetDrawableSize returned 1024x528 on start I'm not sure that's actually a bug. It's returning the real drawable size, which is clipped by the OS navigation bar. Sylvain, do you have any thoughts here? but this "real drawable size" valid only for couple milliseconds then it changes to real fullscreen size. How to initialize game components with real fullscreen size after start? I know the reported size is reduced if there is a status bar or a soft button bar, compared to the physical screen size. But if you toggle the status bar, it should make sense the size is updated, as dmuratshin said. I cannot have a look this week, but maybe next week. I have updated to the latest and also see the same behaviour. Maybe it's expected. Not sure how we should proceed. some hint: 1/ In SDLActivity.java, you can modify onCreate() so that it calls "setWindowStyle(true)" (and not "false"), so you always start in fullscreen. 2/ you use SDL_GL_GetDrawableSize(), instead there are SDL_GetNumDisplayModes() and SDL_GetDisplayMode() which gives the fullscreen size anyway. Sylvain, are you seeing this when you create the window fullscreen? Yes, I create a SDL window with SDL_WINDOW_FULLSCREEN. the request for the fullscreen is done in SDL_CreateWindow(), but the size are really updated when the android surfaceChanged() is executed, as it calls SDLActivity.onNativeResize(). here's my log, with calls to setWindowStyle(). SDL : onCreate() SDL : setWindowStyle() fullscreen=false SDL : onResume() SDL : surfaceCreated() SDL : surfaceChanged() SDL : Window size: 918x1578 SDL : Device size: 918x1632 SDL : nativeResume() SDL : nativeRunMain() Here, SDL_CreateWindow of size width : 918 height : 1632 SDL : setWindowStyle() fullscreen=true Calling SDL_GL_GetDrawableSize: 918 1578 SDL : onWindowFocusChanged(): true SDL : surfaceChanged() SDL : Window size: 918x1632 SDL : Device size: 918x1632 and after that, SDL_GL_GetDrawableSize: 918 1632 This should be fixed by this commit, can you please verify? https://hg.libsdl.org/SDL/rev/d2e5d4520677 It appears to fixed ! Great, thanks! unfortunately not fixed completely :(
Now It can be reproduced on some devices and only at FIRST launch after install.
this patch does not fill me with confidence
try {
SDLActivity.getContext().wait(250);
}
catch (InterruptedException ie)
{
ie.printStackTrace();
}
I don't know why but I can't extract full log on FIRST app launch after install (Huawei P Smart FIG-LX1)
only setWindowStyle(true) in modified onCreate helps to me (of course it is latest SDL from repo) @dmuratshin Does it still happen with the latest SDL source version ? Maybe the screen size should be initialized in onCreate, by calling: nativeSetScreenResolution(width, height, nDeviceWidth, nDeviceHeight, sdlFormat, mDisplay.getRefreshRate()); |