Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* GLSL */
- // fragmentShader:
- #ifdef GL_ES
- precision mediump float;
- #endif
- varying vec4 v_color;
- varying vec2 v_texCoords;
- uniform sampler2D u_texture;
- uniform sampler2D u_maskTexture;
- void main() {
- vec4 color = v_color texture2D( u_texture, v_texCoords );
- vec2 maskCoords = vec2(v_texCoords.x 2.0, v_texCoords.y 12.0);
- vec3 mask_color = texture2D(u_maskTexture, maskCoords).rgb;
- if( color.a == 0.0 ) gl_FragColor = vec4( color.r, color.g, color.b, color.a );
- else gl_FragColor = vec4( mask_color.r, mask_color.g, mask_color.b, color.a );
- }
- // vertexShader:
- attribute vec4 a_position;
- attribute vec4 a_color;
- attribute vec2 a_texCoord0;
- attribute vec3 a_maskTexture;
- uniform mat4 u_projTrans;
- varying vec3 v_maskTexture;
- varying vec4 v_color;
- varying vec2 v_texCoords;
- void main() {
- v_color = a_color;
- v_maskTexture = a_maskTexture;
- v_texCoords = a_texCoord0;
- gl_Position = u_projTrans a_position;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement