-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
This bug report was migrated from our old Bugzilla tracker.
Reported in version: HG 2.1
Reported for operating system, platform: Windows (XP), x86
Comments on the original bug report:
On 2013-10-13 22:16:25 +0000, Waxhead wrote:
System:
WinXPsp3 (32bit)
3 monitor setup 2x Connected to nvidia geforce 8600gts and the third monitor connected to a geforce 7300gt.
nvidia 280.26 driverProblem:
the SDL_SetWindowBrightness() function sets gamma for the entire monitor instead of just the window (as one might expect) as long as the SDL window has focus. If it is unfocused it restore the gamma for the monitor.Also if I move away the window to a second monitor the gamma is NOT restored once the window leaves the monitor (forgets about it). It will however restore if the window is moved back to the original monitor where gamma was set.
Reproducible:
Always
On 2014-06-22 18:18:51 +0000, Sam Lantinga wrote:
That's correct, the brightness is implemented using the device gamma ramp which affects the whole monitor. If you implement your own 3D renderer you can implement brightness as a separate composition pass, but that's more performance intensive.
On 2014-06-23 15:54:54 +0000, Waxhead wrote:
(In reply to Sam Lantinga from comment # 1)
That's correct, the brightness is implemented using the device gamma ramp
which affects the whole monitor. If you implement your own 3D renderer you
can implement brightness as a separate composition pass, but that's more
performance intensive.The documentation states "Use this function to set the brightness (gamma correction) for a window." https://wiki.libsdl.org/SDL_SetWindowBrightness?highlight=%28\bCategoryAPI\b%29|%28SDLFunctionTemplate%29
Since when was a Window synonymous with a monitor?! This is not obvious for the programmer and I suggest either updating the documentation or renaming the function to something a bit more accurate. It is obvious that it does not set the brightness for the window as one might expect.
Also regardless if this function was renamed SDL_SetOutputGamma() or something else there is still a bug, if you move the window to another monitor the gamma is not restored on the monitor it was moved from and the monitor the window is moved to does not inherit the gamma. E.g. the monitor that the window was opened on still has a higher gamma and the other monitor no adjustments made.
On 2014-06-23 22:37:22 +0000, Adam M. wrote:
It is terribly unintuitive, and the . I would personally vote for the functions to be deprecated in favor of SDL_GetDisplayBrightness(int displayIndex) and SDL_SetDisplayBrightness(int displayIndex, float brightness). Temporary macro and wrapper functions called SDL_SetWindowBrightness could prevent breaking existing code (and also emit a compiler warning about the functions being deprecated).
But I would understand if policy stated that SDL 2.0 APIs must never break backwards compatibility. In the mean time, I've updated the documentation.
On 2014-06-23 22:40:25 +0000, Adam M. wrote:
What about SDL_GetWindowGammaRamp and SDL_SetWindowGammaRamp? Do those have the same problems?
On 2014-06-23 22:41:56 +0000, Adam M. wrote:
Also, do the functions support brightnesses outside the range of 0 to 1? Could it be set to 1.5, for instance?
On 2014-06-25 17:54:43 +0000, Waxhead wrote:
(In reply to Adam M. from comment # 3)
It is terribly unintuitive, and the . I would personally vote for the
functions to be deprecated in favor of SDL_GetDisplayBrightness(int
displayIndex) and SDL_SetDisplayBrightness(int displayIndex, float
brightness). Temporary macro and wrapper functions called
SDL_SetWindowBrightness could prevent breaking existing code (and also emit
a compiler warning about the functions being deprecated).But I would understand if policy stated that SDL 2.0 APIs must never break
backwards compatibility. In the mean time, I've updated the documentation.Speaking for myself I am happy with the changes to the documentation as it clearly states how the function works (no one would like a function called DeleteFile() to nuke a directory right?), however the bug that I mentioned is still there to my best knowledge. I don't use Windows anymore :) so I can't test any potential fixes.
On 2014-06-26 04:13:40 +0000, Sam Lantinga wrote:
SDL_SetWindowBrightness() is implemented using SDL_SetWindowGammaRamp(), so it has the same issue.
You can set the brightness to any valid gamma correction value. Typical values are in the range of 0.2 to 5.0.
On 2014-06-27 00:42:54 +0000, Adam M. wrote:
I've updated the documentation for SDL_Get/SetWindowGammaRamp as well, then.
On 2017-08-15 05:22:20 +0000, Sam Lantinga wrote:
Marking for review for SDL 2.1