#version 300 es precision mediump float; uniform sampler2D s_texture; uniform int u_texture_env_mode; in vec4 v_color; in vec2 v_texcoord; out vec4 o_fragColor; void main() { const int texture_env_mode_replace = 0x1E01; const int texture_env_mode_modulate = 0x2100; if (u_texture_env_mode==texture_env_mode_replace) o_fragColor = texture( s_texture, v_texcoord).aaaa; if (u_texture_env_mode==texture_env_mode_modulate){ // o_fragColor = texture( s_texture, v_texcoord).aaaa*v_color; o_fragColor = vec4(1, 1, 1, texture( s_texture, v_texcoord).a)*v_color; } // o_fragColor = v_color; }