| Summary: | [OS X] SDL_SetWindowBrightness does not persist when entering fullscreen | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Eric Wasylishen <ewasylishen> |
| Component: | video | Assignee: | Alex Szpakowski <amaranth72> |
| Status: | ASSIGNED --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | metalcaedes |
| Version: | HG 2.1 | ||
| Hardware: | x86 | ||
| OS: | Other | ||
| Attachments: | patches SDL test programs to accept a --brightness flag | ||
It appears that the OS resets the display gamma to the default around 2 seconds after we do a display mode change. I verified that it's not SDL erroneously resetting the gamma. Also, simply calling Cocoa_SetWindowGammaRamp(_this, window, window->gamma); at the end of Cocoa_SetWindowFullscreen doesn't fix the problem. As one can probably expect from Eric's observations, this also affects SDL_SetWindowGammaRamp() of course. We had this issue reported for Yamagi Quake2 (https://github.com/yquake2/yquake2/issues/134), just so you know more people are affected by this ;-) Any idea why OSX does this? Any ideas/plans for a workaround in SDL? Would probably be ugly as hell to re-set the gamma settings 2 seconds (is it even always exactly two seconds?) after changing resolution or switching from/to fullscreen.. I haven't looked at this in 2 years since reporting, but in Quakespasm we gave up on the SDL brightness API's and switched to doing gamma in a postprocessing fragment shader, only falling back to SDL_SetWindowBrightness on OpenGL 1.x. This has the added benefit of not messing up the gamma of your entire monitor when running in a window. I think these SDL_SetWindowBrightness/GammaRamp API's should be deprecated if it's not possible to fix them. > I think these SDL_SetWindowBrightness/GammaRamp API's should be deprecated if it's not possible to fix them.
Agreed. I also remember getting annoyed at some of Valve's games in macOS for setting the display gamma via window brightness APIs and causing everything to be much more blue than how I had calibrated my display. (Not sure if they still do this or not, it was a few years ago.)
I think window brightness / gamma APIs made a lot more sense in the era before shaders were ubiquitous, but since they can't even work properly and shaders can easily replace them these days, I'd be happy if they were gone.
|
Created attachment 1656 [details] patches SDL test programs to accept a --brightness flag Entering fullscreen mode with SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN) when you previously set a custom brightness level with SDL_SetWindowBrightness() resets the window brightness to the default. Steps to reproduce: - the attached patch adds a --brightness flag to the test programs - launch testdraw2 with "--brightness 0.25". The window should be very dark. - press Control+Enter to enter fullscreen. Expected: the low brightness level persists in fullscreen mode Observed: the demo graphics have reverted to regular brightness in fullscreen mode Tested on Mac OS X 10.9.2 with the latest sdl2 from hg.