iPhone OpenGL ES incorrect alpha blending


iPhone OpenGL ES incorrect alpha blending



I have a problem with incorrect alpha blending results with openGL ES on iPhone.

This is my code for creating texture object:

glGenTextures(1, &tex_name); glBindTexture(GL_TEXTURE_2D, tex_name); glTextImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex_width, tex_height, GL_RGBA, GL_UNSIGNED_BYTE, tex_data); 

'tex_data' is loaded from raw RGBA8888 data packed with zlib. It loads as it should, wich i've checked with a debugger.

This is my code for setting up texture before rendering:

glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);  glBindTexture(GL_TEXTURE_2D, tex_name); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); 

I've uploaded a sample of what I've expected and what I've got here: sample . In the sample most of the texture in the bottom is pitch-black with 70% opacity. However openGL renders it as gray. This problem affects all of my textures I use blend with.

I've tested the code on windows with use of OGLES PVRVFrame and the results are as expected: black is rendered as black.


“EXC_BAD_ACCESS” error when cell begins scrolling back in view?

1:

Button not removed with removedFromSuperVire
Found the problem. Future of Mobile Development [closed]I've forgot to set opaque property of CAEAGLLayer of EAGLView to YES.. Manage user's session on a web server for an iPhone app user [closed]
UIProgressBar loading NSMutableDictionaryPrompting and Delegate question

2:

Results for performSelector: differ from standard dot notation call?
Will this help? glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA) I think this just blends the two instead of blending both against the background.. How to add a breakpoint to objc_exception_throw? Sorry if I don't understand..


74 out of 100 based on 39 user ratings 234 reviews

#