Jump to content
  • Advertisement
Sign in to follow this  
Aphyxia

IPhone alpha blending with opengl es

This topic is 3419 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am currently developing a iphone game and I just put in an alphad .png image and it has random pink and black dots where some of the alpha should be. The part that has me confused is that if i use one of the .png's that comes with the iphone sample code then the alpha works just fine. I've tried saving out the .png quite a few ways with photo shop as well as using preview and paint.net to save it out, either way the dots persist. I did some research and i saw some stuff about pre-multiplied alpha so that could be it but i couldn't find enough info to test that or be sure that was the problem. what the image looks like http://img340.imageshack.us/my.php?image=picture2jt0.png

Share this post


Link to post
Share on other sites
Advertisement
Maybe if you posted some code about how do go about drawing the bitmap or perhaps converting the bitmap into a texture.

-ddn

Share this post


Link to post
Share on other sites
What software did you use to generate your png?

I remember having the same issue and vaguely remembering it having to do with how Gimp handles pngs.

Exporting out of Photoshop seems to work flawlessly, but not everyone has that option.

Share this post


Link to post
Share on other sites
Its because your texture isn't a power of two square (so w == h). I know its crazy, but if your useing the same code I am then thats the reason and there isn't any real fix. If you create a UIImage and draw it to a CGBitmapContext and its not exactly right things just go wonky. Everyone i've talked to about it just say to stay away from that and load them another way (3rd party lib etc).

If you find a nice solution please post it - for the moment I've just ignored it as for hobby code those dots aren't a real problem, but if your doing anything that needs to be release quality it definatly needs fixing.

Edit: Definatly nothing todo with format - I tried gimp, photoshop, mspaint all with/without being pngcrush'd befor I figured out it had nothing todo with that.

Share this post


Link to post
Share on other sites
Sorry guys >< stopped watching the post after no responses for a few days.

Thanks for all the suggestions but yes, the textures are all 32x32 or 512x512 so they are powers of 2 ><.

And I tryed saving them with gimp, paint.net, and photoshop, none of the above fixed it. I finally gave up, did some reaserch on the targa format and wrote a function that parses it myself (Love not having to use apples prewritten functions) Alpha works fine now.

Thanks again ><.

Oh yea, and as far as the power of two thing goes, that is a video card requirement, if its a power of two the video card can use bit shifting to do its manipulation instead of division/multiplication/ect. Therefore requiring textures to be a power of two greatly increases hardware performance.

Share this post


Link to post
Share on other sites
Umm... Sorry, but you are exporting it wrong. That image has no alpha channel as far as PNG is concerned.

This is what it should be like:
http://www.steik.org/dump/hero_walking.png

If you open it in firefox, you will see that my image actually blends with the firefox background, while the background if your image is a solid gray.

I am using that very picture on the iPhone in OpenGL and it blends perfectly.

Share this post


Link to post
Share on other sites
I have the same problems of
Aphyxia. I don't know I export it as Jpeg but have
the result, anyone has pointer?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!