Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Gamma correction: glEnable(GL_FRAMEBUFFER_SRGB) has no effect
Forum Updated to NodeBB v4.3 + New Features

Gamma correction: glEnable(GL_FRAMEBUFFER_SRGB) has no effect

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 850 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    psi-1
    wrote on last edited by
    #1

    I set up surface and texture format in QOpenGLWidget's ctor like this:

    QSurfaceFormat format;
    format.setSamples(8);
    format.setColorSpace(QSurfaceFormat::sRGBColorSpace);
    setFormat(format);
    setTextureFormat(GL_SRGB8_ALPHA8);
    

    With that, gamma correction is applied to the fragment shader output in the default FBO. At least, I can make a screenshot and get some pixel color, and it is approximately (1/2.2)-th power of the fragment shader's output color.

    When I put glEnable(GL_FRAMEBUFFER_SRGB) or glDisable(GL_FRAMEBUFFER_SRGB) anywhere, it makes no difference. As far as I know, it is supposed to turn gamma correction on/off, but it does no such thing.

    Yet on my other machine that same program produces output with gamma correction applied TWICE to it — all in the drawing operation writing to the default FBO. I need to put glDisable(GL_FRAMEBUFFER_SRGB) before it in order to make gamma correction applied only once.

    Why it works that way? And how do I make my program work right on any device?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What graphic stack do you have on your devices ?
      What version of Qt ?
      What OS ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • P Offline
        P Offline
        psi-1
        wrote on last edited by
        #3

        OS is Windows 10 on both machines. It is the latest version of Qt (Qt updater informs me whenever new updates are available). Don't know what graphic stack is, but I have GeForce GTX 1050 with 2Gb RAM and OpenGL 4.6. QOpenGLFunctions_4_5_Core is used to call OpenGL functions.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          psi-1
          wrote on last edited by
          #4

          You may see the whole source code here.
          Sorry I've forgot to mention it. The main part of rendering is in GLWidget.cpp file.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved