Never tried that myself but from OpenGL ES 2.x you could assign two 
textures to a fragment shader that gradually achieves that blending effect 
over time. The simplest blending effect would be linear, which has the 
basic formula:

P_mix = P_a * (1 - t) + P_b * t

where...

   - P_a would be the RGB color channel values of texture A
   - P_b the color channel values of texture B
   - t would be a time factor ranging from 0 to 1 and
   - P_mix is the blended result.


Now my GLSL skills are a bit rusty at the moment. It may look like the 
following (without any lighting calculations):

uniform sampler2D texA;
uniform sampler2D texB;
uniform float t;

varying vec2 texCoord;

void main() {
    vec4 pA = texture2D(texA, texCoord);
    vec4 pB = texture2D(texB, texCoord);
    vec4 pMix = pA * (1.0 - t) + pB * t;
    gl_FragColor = pMix;
}

>From your host app you'd need to animate the uniform value t over time.

On Wednesday, December 24, 2014 4:23:22 AM UTC-8, MobileVisuals wrote:
>
> I want to switch from the first texture to the other one with a gradual 
> fading effect. How can I do that?
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to