简体   繁体   中英

Alpha blending and UIView background color

When I draw semitransparent textures with OpenGL, it looks like that I get them blended with EAGLView backgroundColor.

((EAGLView*)my_view).backgroundColor = [UIColor redColor];

opaque property is set to YES.

Now that image looks red, when I change to black it turns to gray(blended with black), to white it becomes white (even semitransparent black). What can it be?

my blending function setting is: src BFP_SRC_ALPHA, dest ONE_MINUS_SRC_ALPHA I tried also(possibly something like premultiplied alpha): src ONE dest GL_ONE_MINUS_SRC_ALPHA - it gives good result, but I get problems when drawing semitransparent quad(not texture).

问题是在预乘alpha中使用src ONE dest GL_ONE_MINUS_SRC_ALPHA,并且args也必须与预乘alpha一起glColor4f(r * a,g * a,b * a,a)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM