: (The box is displayed from left to right)
Photo resources:
Principle Introduction:
Step one: Put three pictures in position. The picture resource is displayed all at this time. (The aim is to stick to the correctness of the position)
Step two: Write shader. The discard is determined by the texture s coordinate, which is larger than a certain value. The value is 0 o'clock, all is not displayed, the value is 1 o'clock all display, the middle display of the segment is determined by the size worth.
Vertex shader:
Uniform mat4 umvpmatrix;attribute vec3 aposition;attribute vec2 atexcoor;varying vec2 vtexturecoord;void Main () { GL _POSITION=UMVPMATRIX*VEC4 (aposition,1); Vtexturecoord=atexcoor;}
Slice shader:
Precision Mediump float;varying vec2 vtexturecoord;uniform sampler2d stexture;uniform float uspan;void main () { VEC4 Finalcolor=texture2d (Stexture,vtexturecoord); if (vtexturecoord.x>uspan) { finalcolor.a=0.0; } Gl_fragcolor=finalcolor;}
Note: The use of the method is very simple, there is no problem.
A way to load a dynamic picture on the Android loading interface