Reputation: 335
I'm trying to figure out how to use Open GL to combine two unpremultiplied textures (one on top of the other).
Both textures have areas with 0-alpha. I'd like the combined result to be unpremultiplied as well. I've tried multiple combinations of GL_ONE, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, etc but haven't had any luck yet.
Here's what I mean (Texture1 and Texture2 are the input textures, Combo is the desired combination):
Upvotes: 1
Views: 478
Reputation: 335
Wow...after too long on this, it looks like the image I created for this question led me to the answer.
Here's what did the trick:
glBlendFuncSeparate( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA );
Upvotes: 1