From 89c6e7c37162528b1949d574cbc799d749d8321b Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 22 Dec 2014 01:54:07 +0900 Subject: [PATCH] Add comments --- internal/opengl/internal/shader/shader.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/opengl/internal/shader/shader.go b/internal/opengl/internal/shader/shader.go index d7a703896..43574edb4 100644 --- a/internal/opengl/internal/shader/shader.go +++ b/internal/opengl/internal/shader/shader.go @@ -86,7 +86,11 @@ void main(void) { vec4 color1 = texture2D(texture1, vertex_out_tex_coord1); color0 = (color_matrix * color0) + color_matrix_translation; - // Photoshop-like RGBA blending + // Photoshop-like RGBA blending. + // + // NOTE: If the textures are alpha premultiplied, this calc would be much simpler, + // but the color matrix must be applied to the straight alpha colors. + // Thus, straight alpha colors are used in Ebiten. gl_FragColor.a = color0.a + (1.0 - color0.a) * color1.a; gl_FragColor.rgb = (color0.a * color0.rgb + (1.0 - color0.a) * color1.a * color1.rgb) / gl_FragColor.a; }