(this could be a bug)
Just came across an issue about Colour RGB codes under different juce renderers.
When using different renderers on juce/Mac, a colour with a fixed RGB codes will have slight but noticeable difference between the default 2d graphics renderer and juce’s OpenGLContext.
For example, with Mac’s own Utility/DigitalColorMeter tool. “sRGB” colour mode shows the correct colour for the default renderer. That is to say, the colour the meter shows matches the RGB code I hard coded in my juce app.
When under OpenGLContext, “native values” shows the correct RGB values of what I hard coded in my juce app.
As a consequence, the colour I set in my juce app will have a drift when using against the two renderer modes.
Yes this is correct. In fact, I had the opportunity to talk to an Apple engineer about this:
When using core graphics, the OS will apply the necessary conversions for you. When using OpenGL you write directly into the pixel buffer and should take care of colour-space conversions yourself. JUCE does not do this currently.
The problem can most easily be illustrated with wide-colour gamut colour spaces. In this colourspace, you can use
CGColor floating point values which are greater than 1.0 with respect to sRGB. Therefore, in CoreGraphics, if you create a normal bitmap image with 8-bit colour components, it’s impossible to have colours in the wide-colour gamut space as there is no way to represent components >1.0. Your colours will always be sRGB.
OpenGL, however, works different: in OpenGL the 8-bit colour components will always be mapped to the maximum range of the colour component in the native colour space of the monitor. Therefore, for OpenGL, a component value of 255 will be something like 1.1 in the sRGB colour space.
This means that when JUCE loads the same 8-bit colour component bitmap image in OpenGL - the colours will appear more vivid than when showing the same bitmap with CoreGraphics.
Basically, JUCE would need to do the colour conversions manually.
I am having the exact same problem.
Glad I found your answer.
Question to you and anyone else:
How do I find the OpenGL colour conversion?
I want to apply the reverse conversion, to get correct colours again.
Any advice how to proceed?
Same problem here.
Did you find a way to apply a color correction ?
Would be fantastic if that feature was included in Juce.
I wonder if this is useful,
(unless it’s not only deprecated but also broken)