Moonlight
Moonlight

Reputation: 37

bad quality image in iOS in GLKit

i added sprite to scene by this tutorials : http://www.raywenderlich.com/9743/how-to-create-a-simple-2d-iphone-game-with-opengl-es-2-0-and-glkit-part-1

but i have bad quality of images files. how to fix problems ??

enter image description here

Upvotes: 0

Views: 790

Answers (1)

rotoglup
rotoglup

Reputation: 5238

This is probably caused by xcode 'compression' of PNG files, which transforms them to use premultiplied alpha.

You could try to replace the line :

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

which I suppose you have, as you mentioned following the tutorial, by the following :

glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

which allow to composite a premultiplied alpha image over the background image.

For more information about premultiplied alpha concept, look here.

If you want xcode to stop messing with your PNG files, you can ask it to stop : How can I skip compressing one PNG?

Upvotes: 1

Related Questions