Closed lunabunn closed 3 years ago
There should totally be a flag.
But most people will want that to be true
(for modern computer monitors at least).
I have no idea why I set it to false
. It may be a remnant of when I was experimenting with rendering wider than sRGB color spaces.
Makes sense.
Assuming you won't get to it before then, I'll try to get a PR in to add the flag & implement it on Windows. I have no idea how any of this works on mac though.
Cool! Thanks for the PRs, I really appreciate it.
I'll investigate to see if I can figure out how to implement it on Mac (thought if I'm remembering right the story is a bit more complex).
Implemented on Windows.
On MacOS I'm nervous that setting the window to sRGB may cause performance issues, based on similar issues in other libraries:
https://github.com/libsdl-org/SDL/issues/3645 https://github.com/OpenTTD/OpenTTD/issues/7644
However we can probably just document that there may be performance issues when using an sRGB back-buffer on Mac.
@kettle11 AFAICT, that second issue you linked improves perf by setting sRGB. It's actually mentioned in the first issue you linked.
I couldn't find any other references to this issue, though note that OpenTTD was able to improve performance by setting the colorspace OpenTTD/OpenTTD#7644
@lunabunn Oh yup, you're right!
I missed that somehow. Interesting. I guess we'll just have to keep an eye out for performance issues related to this setting.
For now I added sRGB support to MacOS, which is cool because that means we can render sRGB colors mostly consistently across Mac / Windows / Web, which is something other libraries have historically not handled well.
EDIT:
Add an
srgb
flag toGLContextAttributes
and implement it for different platforms.Web currently doesn't support specifying the color space, see: https://github.com/WICG/canvas-color-space/blob/master/CanvasColorSpaceProposal.md
Original Issue:
Currently, I'm using a fork that changes https://github.com/kettle11/kapp/blob/fa32eb749dbbf9f5d83135841917bc692ce24c2a/gl_context/src/windows/mod.rs#L202 into
true
, but that's obviously not a great solution 😅Why is that a
false
, anyway? Is it a placeholder? Shouldn't there be a flag for this inGLContextAttributes
?