I want to make a scene that is made of several layers. Every layer has it's own render target(frame buffer object) and textures are rendered on it. Obviously I need a FBO that can be cleared to (0,0,0,0), so at the end when I render it all to my final scene(backbuffer) they don't cover each other.
To be able to clear the FBO to (0,0,0,0) the texture that is bind to the FBO supports alpha channel glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,w,h,0,GL_RGBA,GL_UNSIGNED_BYTE,data). The problem is when I render something transparent(like a water bubble) on this type of FBO it makes the FBO transparent there, like in this picture:
This is what I want, a normal result using glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA). I don't know what is the problem here, the created texture for the FBO, blending mode... ?