I am looking for a way to blend smoothly between 2 overlapping textured quads. The textures are subsequent sprite animation frames. These textures have a fully opaque area in the middle, with the pixels near the border being transparent.
I would like to blend between the images in such a way that at every step when blending from the first to the second texture, the place where the opaque regions on both textures overlap have no influence of the background showing through.
If I blend both quads like this:
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD);
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
then the overlapping opaque areas loose their full opacity, because the background gets blended in. If both textures are at 0.5 opacity, then the background has an influence of 0.25 on the image, because the first blend was with the background.
I could create a frame buffer, on which I could draw the first quad full opacity, and then blend the second quad with the first, and then render the frame buffer to a texture full opacity on the original scene.
Is there another way to do this?
Thanks.