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: http://gamedevelopment.tutsplus.com/articles/gamma-correction-and-why-it-matters--gamedev-14466 ). Without gamma correction, I would expect to see mid-range colors darkened non-linearly by my monitor.
But here is what I actually see; first with no gamma correction on my part, then with gamma correction:
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:
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;
}
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:
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;
}
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.
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).
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?
My question is sort of a duplicate of this: Do I need to gamma correct the final color output on a modern computer/monitor 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.