#version 300 es precision mediump float; in vec2 vertTexCoord; in vec4 vertColor; in float vertTextureIndex; uniform sampler2D colorTextures[8]; out vec4 fragColor; void main() { fragColor = vec4(0, 0, 0, 0); fragColor += texture(colorTextures[0], vertTexCoord) * (step(-0.5, vertTextureIndex) - step(0.5, vertTextureIndex)); fragColor += texture(colorTextures[1], vertTexCoord) * (step( 0.5, vertTextureIndex) - step(1.5, vertTextureIndex)); fragColor += texture(colorTextures[2], vertTexCoord) * (step( 1.5, vertTextureIndex) - step(2.5, vertTextureIndex)); fragColor += texture(colorTextures[3], vertTexCoord) * (step( 2.5, vertTextureIndex) - step(3.5, vertTextureIndex)); fragColor += texture(colorTextures[4], vertTexCoord) * (step( 3.5, vertTextureIndex) - step(4.5, vertTextureIndex)); fragColor += texture(colorTextures[5], vertTexCoord) * (step( 4.5, vertTextureIndex) - step(5.5, vertTextureIndex)); fragColor += texture(colorTextures[6], vertTexCoord) * (step( 5.5, vertTextureIndex) - step(6.5, vertTextureIndex)); fragColor += texture(colorTextures[7], vertTexCoord) * (step( 6.5, vertTextureIndex) - step(7.5, vertTextureIndex)); fragColor *= vertColor; }