A way to load a dynamic picture on the Android loading interface

Source: Internet
Author: User

: (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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.