0

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

Tim
  • 35,413
  • 11
  • 95
  • 121
Moonlight
  • 37
  • 1
  • 5
  • 1
    Could you be more specific? This is unanswerable. – Tim Jul 01 '12 at 19:35
  • As Tim indicates, "bad quality image" doesn't really tell us anything. Is the texture stretched? Pixellated? Can you possibly attach an image showing what you're getting and what you'd like to get? – Brad Larson Jul 01 '12 at 19:39
  • @Brad Larson , Hi , i know you from Madison College , i watch your class from Video in iTunes. i add Image to my Topic, you can see, Orginal Image have no any border , very smoothly, and Gradient is change.this effect for all images. – Moonlight Jul 01 '12 at 20:14
  • @Tim , See my Image in my topic , and you can see all bad Quality. – Moonlight Jul 01 '12 at 20:15
  • @Ehsan' - So the specific problem is that you're seeing a black border around your circular image? Is this circular image texture loaded from a PNG or JPEG? If a PNG, does is have an alpha channel? You might be seeing artifacts from antialiasing of the circle edges in your drawing program, so you might need to save the image without an alpha channel. – Brad Larson Jul 01 '12 at 20:18
  • from PNG and my images have any Background. i need Transparenty i can't remove Alpha , i need just my shape without any back ground? how do i can ? if you see my Orginal Image , is very smooth , but when add in scene smooth convert to sharpen. – Moonlight Jul 01 '12 at 20:46

1 Answers1

1

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?

Community
  • 1
  • 1
rotoglup
  • 5,223
  • 25
  • 37
  • and how i can add Retina Support to GLKit projects ? @2x not support in OpenGL Projects ?? – Moonlight Jul 01 '12 at 21:47
  • @Ehsan' you're welcome, if this is the case, you're supposed to 'accept' the answer using the 'tick' button. If you have other questions, you'll find more answers by creating proper new questions on the site. Make sure to search before to avoid create duplicate questions. – rotoglup Jul 02 '12 at 06:28