Wrong parameters in glBlendFunc() function?

I was playing around with alpha blending textures and I am not quite sure what's going wrong.
I created a .png file with a gradient for alpha from 0 to 255 (I also tried hardcoding an RGBA buffer to rule out issues with reading the .png file) and when using glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); I am not getting what I'd expect: a gradually decreasing transparency.
The rendered output looks as almost as if blending didn't work at all, except for values of 0 and 255.
However, when I use glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); then the gradient looks perfect.
Just wondering if I am doing something wrong or if we should be using glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); instead?
Thanks.

Btw, is there a forum search function like the one we had in the old forums?
Please be sure to watch the Handmade Hero episodes that deal with premultiplied vs. nonpremultiplied alpha. In Handmade Hero our bitmaps all use premultiplied alpha, so glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA) is the correct equation. It sounds like you are not premultiplying your colors by alpha, so you would need to use glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) to have the GPU do this multiplication for you.

Note, as covered in the videos, that this will produce slightly incorrect results when used with bilinear filtering, since only premulitplied alpha properly distributes in bilinear filtering (which is why we use it on Handmade Hero).

- Casey
TeddyFine
Btw, is there a forum search function like the one we had in the old forums?


It's on our bug/feature list, so it will be looked at and implemented. Please file any new bug or feature request here

Edited by Abner Coimbre on Reason: Wording
Thanks for clarifying this again, Casey.
Thanks for letting me know, Abner.