all repos — mgba @ 7436a5afef25fcb9160aa1884cc31503bc739f2b

mGBA Game Boy Advance Emulator

OpenGL: Simplify desaturation by using mix
Jeffrey Pfau jeffrey@endrift.com
Tue, 26 Jan 2016 23:28:34 -0800
commit

7436a5afef25fcb9160aa1884cc31503bc739f2b

parent

b9b650ead2a742c8461804a96a71bd78d3b81e9d

1 files changed, 1 insertions(+), 1 deletions(-)

jump to
M src/platform/opengl/gles2.csrc/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" "}";