-
OpenGL and color management
I'm a litte confused as to how opengl interacts with the color management system in the OS.
Are fragments written to the framebuffer transformed by the active monitor profile before scanout or does opengl just ignore this?
Assuming opengl takes color management into account, what is the color space of the framebuffer? I know there is a sRGB framebuffer extension, so if that is used, it is obviously sRGB. But if that extension isn't used, what is the color space then?
Thanks!
-- Anders
-
Senior Member
OpenGL Pro
Re: OpenGL and color management
I am not aware of OpenGL taking such things in account. What it does, it renders an image in certain format to a window. Usually this format is rgba. So if you write a RGB(1, 1, 0) pixel to a window, it will be RGB(1, 1, 0). This is from GL point of view. If the window system uses some sort of gamma correction etc., this correction will be applied afterwards to the window image. To make it short, this is a linear RGB space, if you query an RGB render target.
-
Re: OpenGL and color management
I am not talking about gamma correction, but color spaces. RGB is not a well defined color space, like sRGB, CIE XYZ or Adobe RGB.
But if opengl is "color space agnostic" I find it strange that there exists an EXT_framebuffer_sRGB then, since it only takes gamma part of the sRGB spec into account and not the gamut part.. perhaps it should be called EXT_framebuffer_gamma22 instead?
-
Advanced Member
Frequent Contributor
Re: OpenGL and color management
Just curious-- what sort of application do you have that would benefit from color managed OpenGL?
If you were able to specify the color space of the GL framebuffer, how do you envision this interacting with the rest of a color-managed system? Potentially one that has multiple displays, each with a different profile, running multiple windowed applications, each with different color spaces.
If your specified framebuffer color space is different from the active monitor(s) profile, some conversion will likely need to be done on swap. Are you willing to accept the performance impact of this? What about in a fullscreen application?
-
Re: OpenGL and color management
Any application that cares about accurate color would benefit.
I.e. if nothing is known about the color space of opengl, how can you display an image (say a jpeg or tiff) with some well defined color space correctly (assuming you have a calibrated monitor with a color profile).
You wouldn't know what color space to convert the pixels in the image color space to.
-
Advanced Member
Frequent Contributor
Re: OpenGL and color management
if we assume that opengl doesnt manage colors at all then you can look up the monitor profile on the machine and do the conversion in a fragmentshader, that is , render everything to a FBO and in the final copy to screen do the math per pixel.
One problem could be vista, where we more or or less always render to an fbo and let the windowsystem copy that to the screen, does vista colormanage that copy? could be possible since vista has a more complete colormanager in the core.
-
Senior Member
OpenGL Pro
Re: OpenGL and color management
Color management will happen when image is displayed on the screen, in Vista and in XP too. Basically RGB is treated as it should be, where 0 is nothing on the color channel and 1 is maximal intensity. The interpretation of this values are left to the hardware (graphics device/monitor). As I understand sRGB, it is just a RGB variant that should ensure the best precision in respect to existing monitors. But if I am not mistaken, the operation system should care of best RGB to monitor mapping, as it has all the information about monitor properties. How is it done in professional software like photoshop?
-
Re: OpenGL and color management
In photoshop you can setup a "working color profile", which defaults to the color profile of the image you load or srgb if no color profile is specified.
On windows you can call SetICMProfile(HDC, profile) to set the color profile for a particular device context. I've tried doing that for the device context for the the window in my opengl app. It's doesn't produce any errors, ie. the call succeeds, but if it only affect GDI and not opengl I don't know?
-
Senior Member
OpenGL Pro
Re: OpenGL and color management
How do you know it doesn't affect OpenGL? Did you run some tests? Is there a visual difference when you set different profiles?
-
Re: OpenGL and color management
I dont know if it affects opengl, since I haven't dont any tests yet
Btw, SetICMProfile appears to be for setting output profiles, which is for hardcopy devices?
SetColorSpace OTOH is for input devices, so it might the better suited.
I'll try a simple test with an image in adobe rgb and compare it to photoshop..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules