Emblazed Emblazed - 4 days ago 4
iOS Question

OpenGL Alpha Blend Error after IOS7 update

After update to IOS 7 I am seeing an error with images rendering with GL_BLEND enabled and the blend func set to GL_ONE, GL_ONE_MINUS_SRC_ALPHA.. I have checked that devices that have not been updated to IOS 7 do not show this problem.

Explanation of what I am seeing.
-Images that have any alpha that is not zero render as non transparent (opaque).

This resulted in show white outlines around art that was blending out to full alpha to hide jagged edges.

enter image description here

Notice the render artifacts around the each of the parts that make up this little guy.

Another thing to note is that the art images are NOT compressed to PVR4.

Keep in mind again that this all worked pre IOS7 with no graphical errors.

Thanks for you help..

Render Notes:
glEnable(GL_BLEND)
glBlendEquation( GL_FUNC_ADD )
glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA )

After looking into this.. I have come to think that something has changed with precompiled alpha. I have no idea what could have changed in iOS 7 .. Still working on this.

Solved
My understanding is that the call textureWithContentsOfFile without saying you wanted GLKTextureLoaderApplyPremultiplication in our case seemed to still produce a image that had premultiplied alpha. By adding into the options that YES we wanted it to do so .. everything now on iOS7 is working.

Answer

If you are using for loading textures the method -textureWithContentsOfFile:options:error of GLKTextureLoader, then you could try adding GLKTextureLoaderApplyPremultiplication set to YES to the options dictionary.

NSDictionary * options = @{GLKTextureLoaderApplyPremultiplication:@YES};

NSError *err;
GLKTextureInfo *ti = [GLKTextureLoader textureWithContentsOfFile:path options:options error:&err];
Comments