PDA

View Full Version : Question about Premultiplied Alphas



Xoroh
10-20-2011, 10:40 AM
[ Language C++ ]

Ive been scouring google for the info I need to solve this problem I,m having involving glBlendFunc. I can't get my 2d images to show up correctly. They're always half transparent or don't remove the black pixels, and overlap incorrectly.

I found a potential solution involving Premultiplied Alphas. But I don't know how they work or how to apply them. Do I apply it in an image editor like Gimp? Though the texture loading process? Or though OpenGL commands perhaps?

If I have to apply it to images, what format should I use? I have been using PNG's with black background for transparency.

If anyone could tell me how it works that would be mighty nice of ya.

Dark Photon
10-20-2011, 11:54 AM
Suggest you read this first to see how it works, and then you'll be able to intuit what method will work best for you:

* Premultiplied alpha (Tom Forsyth) (http://home.comcast.net/~tom_forsyth/blog.wiki.html#%5B%5BPremultiplied%20alpha%5D%5D)

To your question, it can be done in the file, or after loading in many cases. Whatever works best. Excepting special cases like precompressed DXT1 textures, where premultiplied alpha is assumed.