title: OpenGL: Gamma corrected image doesn't appear linear
body: <p>I'm using OpenGL for rendering, and when I write linear values to the default framebuffer (without any gamma correction) they appear linear on my monitor. This goes against everything I thought I knew about gamma correction (as explained here: <a href="http://gamedevelopment.tutsplus.com/articles/gamma-correction-and-why-it-matters--gamedev-14466" rel="nofollow noreferrer">http://gamedevelopment.tutsplus.com/articles/gamma-correction-and-why-it-matters--gamedev-14466</a> ). Without gamma correction, I would expect to see mid-range colors darkened non-linearly by my monitor.</p>
  
  <p>But here is what I actually see; first with no gamma correction on my part, then with gamma correction:
  <img src="https://i.stack.imgur.com/bVHea.png" alt="enter image description here"></p>
  
  <p>Here's my fragment shader without gamma correction (drawn on a fullscreen quad to the default framebuffer). This results in the linear image on the left:</p>
  
  <pre><code>out vec4 fsOut0;
  
  void main( void )
  {
      // split the screen into 10 discrete color bands
      float yResolution = 768.0;
      int intVal = int(gl_FragCoord.y / yResolution * 10.0);
      fsOut0.rgb = vec3( float(intVal) / 10.0 );
  
      fsOut0.a = 1.0;
  }
  </code></pre>
  
  <p>And here's the shader with added gamma correction (from linear space to sRGB). This results in the brighter-than-linear image on the right:</p>
  
  <pre><code>out vec4 fsOut0;
  
  void main( void )
  {
      // split the screen into 10 discrete color bands
      float yResolution = 768.0;
      int intVal = int(gl_FragCoord.y / yResolution * 10.0);
      fsOut0.rgb = vec3( float(intVal) / 10.0 );
  
      // gamma correction
      fsOut0.rgb = pow( fsOut0.rgb, vec3(1.0/2.2) );
  
      fsOut0.a = 1.0;
  }
  </code></pre>
  
  <p>I'm verifying whether or not the colors are linear just by looking at them, and by using the color picker in Photoshop and looking at the differences in RGB values between color bands. For the linear-looking image the difference between each color is (mostly) constant.</p>
  
  <p>I have also tried requesting an sRGB-capable default framebuffer. In this case, writing linear values with no gamma correction looks like the second image (non-linear).</p>
  
  <p>What am I doing wrong? Or could it be that my two monitors are both miscalibrated AND that Photoshop does not pick colors in linear space? Or is my "non-linear" image actually the correct linear result, but it just doesn't seem linear to my eyes?</p>
  
  <p>My question is sort of a duplicate of this: <a href="https://stackoverflow.com/questions/23026151/do-i-need-to-gamma-correct-the-final-color-output-on-a-modern-computer-monitor">Do I need to gamma correct the final color output on a modern computer/monitor</a>
  Unfortunately the accepted answer is extremely confusing and the parts of it I was able to follow seem contradictory, or at least not fully explained for someone less knowledgeable than the answerer.</p>