1
votes

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).

1

1 Answers

0
votes

the problem is in premultiplied alpha use src ONE dest GL_ONE_MINUS_SRC_ALPHA, and args must be with premultiplied alpha too glColor4f(r*a, g*a, b*a, a)