Search code examples
openglsrgbwgl

WGL - ChoosePixelFormat and sRGB framebuffer


I have a legacy OpenGL application which sets a pixel format based of ChoosePixelFormat instead of wglChoosePixelFormatARB or wglGetPixelFormatAttribivARB/wglGetPixelFormatAttribfvARB. ChoosePixelFormat doesn't allow to set a framebuffer color space explicitly using WGL_EXT_colorspace Despite that I have noticed that calling glEnable(GL_FRAMEBUFFER_SRB) provides a color space conversion when render a test texture. How does it work ? Does ChoosePixelFormat sets sRGB colorspace by default ?


Solution

  • You already answered your own question:

    ChoosePixelFormat doesn't allow to set a framebuffer color space explicitly.

    There is nothing in the rules for ChoosePixelFormat which forbids an implementation to return a pixel format which supports sRGB encoding. But it is also not required. You can't rely on anything here. But on a modern windows using a compositor ("Aero" or whatever microsoft likes to call it), you typically will see sRGB support, but still there is no guarantee.