Iphone – How to get rid of artifacts in the OpenGL ES iPhone app

iphoneopengl-es

I'm using the Texture2D class from the CrashLanding sample code. I'm getting strange artifacts around my images in both the simulator and the phone. The artifacts are little gray borders around the textures. The borders are inconsistent and do not surround the entire texture. I'm using pngs.

Best Answer

Hey MrDatabase - It sounds like the problem is that your texture images have premultiplied alpha. I've had this problem on the iPhone too - the PNG compression that it performs when you build your app automatically premultiplies all the alpha values. If you're using glBlend(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA), you're basically applying the alpha twice - try using glBlend(GL_ONE, GL_ONE_MINUS_SRC_ALPHA) instead. There's lots of stuff in the Apple forums about this :-)