Open ell1e opened 3 years ago
That seems like a good idea. Do you want to submit a PR?
I'm actually quite bad with the 3d accelerated graphics APIs :joy: which is why I like SDL Renderer so much. So at this point I don't think I will dare to implement this myself :eyes:
grin I totally understand. Well, I'll leave this bug report here in case anyone else wants to take a crack at it.
After reading
SDL_SetWindowGammaRamp()
andSDL_SetWindowBrightness
, I have wondered if both aren't a bit archaic. Don't most modern OpenGL/Vulkan apps do internal LUT/color mapping anyway which can trivially include gamma correction? This left me to realize that this is however currently completely unavailable to programs using SDL_Renderer which would potentially affect a huge bunch of 2D games, even though the render backends also use shaders under the hood that could apply this almost for free even on slower mobile GPUs. Since reliable ingame gamma settings (and my user experience with the display-focused ones has been that they are not reliably available) can be considered an accessibility feature, I think it'd be great if that was changed.I am therefore suggesting a
SDL_SetRendererGammaRamp(SDL_Renderer *renderer, const Uint16 * red, const Uint16 * green, const Uint16 * blue);
which should apply the gamma correction as soon as any operations reach the final window render target. I would expect it to affectSDL_RenderReadPixels
too, and find that an acceptable or even natural consequence. I would find this new gamma thing useful even if the software renderer didn't support this new functionality, but ideally it also would (even assuming in software it would cause a much bigger performance hit).