OpenGL: Simplify desaturation by using mix

This commit is contained in:
Jeffrey Pfau 2016-01-26 23:28:34 -08:00
parent b9b650ead2
commit 7436a5afef
1 changed files with 1 additions and 1 deletions

View File

@ -50,7 +50,7 @@ static const char* const _fragmentShader =
" vec4 color = texture2D(tex, texCoord);\n"
" color.a = 1.;\n"
" float average = dot(color.rgb, vec3(1.)) / 3.;\n"
" color.rgb = vec3(average) * desaturation + color.rgb * (vec3(1.) - desaturation);\n"
" color.rgb = mix(color.rgb, vec3(average), desaturation);\n"
" color.rgb = scale * pow(color.rgb, vec3(gamma, gamma, gamma)) + bias;\n"
" gl_FragColor = color;\n"
"}";