opengl es - Blending a transparent image shows a white factor -


why image shows white , when alpha factor has been made zero. should transparent. using blending function glblend(gl_one,gl_one_minus_src_alpha).

it makes sense, details read official documentation carefully.

but simple explanation let me give simple example. imagine source (255,0,0,0) (using (r,g,b,a) notation) , destination (0,255,0,0). source value weighted gl_one translates (1.0f,1.0f,1.0f,1.0f) , source (1-0.0f,1-0.0f,1-0.0f,1-0.0f) because src_alpha 0. simplified calculation color be:

r = 255 * 1.0f + 0   * 1.0f = 255 g = 0   * 1.0f + 255 * 1.0f = 255 b = 0   * 1.0f + 0   * 1.0f = 0 = 0   * 1.0f + 0   * 1.0f = 0     |      |      |     |     |      |      |   destination weight     |      |      |     |      |    destination color     |      |     |     source weight     |   source color 

so final color (255,255,0,0). may confused fact source after being weighted gl_one has alpha of 0 doesn't mean because didn't tell opengl use alpha value anything.

also, remember simplified , if provided vertex color there may interaction gltexenv , gl_texture_env_mode setting.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -