I’m working on an OpenGL project in Android where I display images with a P3 color profile. Surprisingly, even without any special setup in my OpenGL surface, the images appear correctly on the screen. For example, I can see the logo in this P3 image clearly: https://2.bp.blogspot.com/-LqRniYeVeEk/XOLYEiOcKCI/AAAAAAAAJXI/IAn0yO21XYkwnkUnDlHtdPGI6VyMDEoeACLcBGAs/s1600/android_p3.png.
In my Android app, I decode all bitmaps with the inPreferredColorSpace
set to Display.getPreferredWideGamutColorSpace
. Therefore, the decoded bitmap could be in any color space (Display P3, sRGB, etc.) depending on the result of inPreferredColorSpace
. Then, I convert this bitmap to a texture using GLUtils.texImage2D
like this:
GLUtils.texImage2D(
GL_TEXTURE_2D, // target
0, // level
Source, // bitmap
0); // border
My question is, why are the colors drawn correctly even though I didn’t set up anything particular in OpenGL for handling different color spaces? Is OpenGL doing some automatic conversion or compatibility handling in the background? Any insights or explanations would be greatly appreciated.