diff --git a/internal/graphics/shader.go b/internal/graphics/shader.go index df9daf898..962befda9 100644 --- a/internal/graphics/shader.go +++ b/internal/graphics/shader.go @@ -32,15 +32,15 @@ attribute vec2 vertex; attribute vec4 tex_coord; attribute vec4 geo_matrix_body; attribute vec2 geo_matrix_translation; -varying vec2 vertex_out_tex_coord; -varying vec2 vertex_out_tex_coord_min; -varying vec2 vertex_out_tex_coord_max; +varying vec2 varying_tex_coord; +varying vec2 varying_tex_coord_min; +varying vec2 varying_tex_coord_max; void main(void) { - vertex_out_tex_coord = vec2(tex_coord[0], tex_coord[1]); - vertex_out_tex_coord_min = + varying_tex_coord = vec2(tex_coord[0], tex_coord[1]); + varying_tex_coord_min = vec2(min(tex_coord[0], tex_coord[2]), min(tex_coord[1], tex_coord[3])); - vertex_out_tex_coord_max = + varying_tex_coord_max = vec2(max(tex_coord[0], tex_coord[2]), max(tex_coord[1], tex_coord[3])); mat4 geo_matrix = mat4( vec4(geo_matrix_body[0], geo_matrix_body[2], 0, 0), @@ -63,17 +63,17 @@ precision mediump float; uniform sampler2D texture; uniform mat4 color_matrix; uniform vec4 color_matrix_translation; -varying vec2 vertex_out_tex_coord; -varying vec2 vertex_out_tex_coord_min; -varying vec2 vertex_out_tex_coord_max; +varying vec2 varying_tex_coord; +varying vec2 varying_tex_coord_min; +varying vec2 varying_tex_coord_max; void main(void) { vec4 color = vec4(0, 0, 0, 0); - if (vertex_out_tex_coord_min.x <= vertex_out_tex_coord.x && - vertex_out_tex_coord_min.y <= vertex_out_tex_coord.y && - vertex_out_tex_coord.x < vertex_out_tex_coord_max.x && - vertex_out_tex_coord.y < vertex_out_tex_coord_max.y) { - color = texture2D(texture, vertex_out_tex_coord); + if (varying_tex_coord_min.x <= varying_tex_coord.x && + varying_tex_coord_min.y <= varying_tex_coord.y && + varying_tex_coord.x < varying_tex_coord_max.x && + varying_tex_coord.y < varying_tex_coord_max.y) { + color = texture2D(texture, varying_tex_coord); } // Un-premultiply alpha