I'm trying to render a set of textured geometry to a single FBO, and then render that FBO to the scene. The problem is that overlapping semi-transparent areas of that geometry are not rendered correctly. They end up too opaque and dark. If I render the geometry directly to the scene it renders correctly, but I need to render it first to the FBO.
By the way, I'm using the following for blending (according to opengl - blending with previous contents of framebuffer):
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE)
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)
I'm doing this for OpenGL ES 2.0.
Actually, I found that the problem was the blending function used to render the geometry to the FBO.
Instead of:
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE)
I have to use:
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA)
And now it works as good as if I was rendering the geometry directly to the scene.