I draw two textures, first Texture A and then Texture B. I always appears that A is always above b and even if some part of texture A is completely transparent, it just display the background color of screen. The background color here means the color i set with glClearColor. And however i change my code and picture, the transparent part of texture always has the same color of background color.
Here is my shader language source code.
precision mediump float;
uniform sampler2D u_sampler;
varying vec2 v_TexCoord;
void main() {
gl_FragColor = texture2D(u_sampler, v_TexCoord);
}
And i have already enabled blending function.
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Are you rendering this with 2 draw calls or are you using multi-texture. If you are doing it as 2 draw calls then turn off the depth-test as the second texture will always fail the depth test (as its not in front of the polygon in the same place as it) and hence won’t get drawn.
If you are using multi-texture then your problem probably lies with how you are setting up alpha.
I really suspect it the former though.