mosra / magnum-integration

Integration libraries for the Magnum C++11 graphics engine
https://magnum.graphics/
Other
97 stars 44 forks source link

imgui-integration: ColorPicker gradient appears jagged on macOS using glfw #59

Closed melix99 closed 4 years ago

melix99 commented 4 years ago

This only happens using glfw and using macOS (doesn't happen on Linux, untested on Windows).

image

mosra commented 4 years ago

Huh. So, in other words, if you use SDL, it doesn't happen on macOS? Might it be that GLFW defaults to a 16-bit framebuffer for some reason and SDL doesn't. That's probably the reason why this happens -- the hue bar seems to have color banding as well, though it's not as noticeable.

Can you try configuring setColorBufferSize() to {8, 8, 8, 8} instead of the default?

melix99 commented 4 years ago

So, in other words, if you use SDL, it doesn't happen on macOS?

Yep, exactly.

Can you try configuring setColorBufferSize() to {8, 8, 8, 8} instead of the default?

Yay, that fixed the problem!

mosra commented 4 years ago

Hmm. Then I think it might be reasonable to make that a default everywhere ... but not sure about perf implications on slower platforms, such as the web. For the record, neither Metal nor D3D supports 24-bit framebuffer formats, so {8, 8, 8, 0} probably picks some RGBX anyway.

I'll give this some thought and if I don't come up with any better solution, I'll make the change.

mosra commented 4 years ago

Fixed in mosra/magnum@e6dc5be1af95d6df7ec542624483304bfbef0d4a -- I didn't come up with anything better, so all apps now default to a 32-bit RGBA framebuffer. If this causes some platforms to be suddenly slower, people can always override this, and I believe it's better to be correct by default than fast but incorrect by default.