OpenGL: Simplify desaturation by using mix
Jeffrey Pfau jeffrey@endrift.com
Tue, 26 Jan 2016 23:28:34 -0800
1 files changed,
1 insertions(+),
1 deletions(-)
jump to
M
src/platform/opengl/gles2.c
→
src/platform/opengl/gles2.c
@@ -50,7 +50,7 @@ "void main() {\n"
" 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" "}";