2
0

opengl_fragment.glsl 470 B

123456789101112131415161718192021
  1. uniform sampler2D baseTexture;
  2. uniform sampler2D normalTexture;
  3. uniform sampler2D textureFlags;
  4. #define leftImage baseTexture
  5. #define rightImage normalTexture
  6. #define maskImage textureFlags
  7. void main(void)
  8. {
  9. vec2 uv = gl_TexCoord[0].st;
  10. vec4 left = texture2D(leftImage, uv).rgba;
  11. vec4 right = texture2D(rightImage, uv).rgba;
  12. vec4 mask = texture2D(maskImage, uv).rgba;
  13. vec4 color;
  14. if (mask.r > 0.5)
  15. color = right;
  16. else
  17. color = left;
  18. gl_FragColor = color;
  19. }