I am trying to create an FBO, draw to it on the alpha channel and then apply the FBO to the main buffer.
Basically I have a video stream being played on the main buffer and I want to create some overlays to display on top of it.
I have a library to create and initialize the FBO… the texture it creates has an RGBA flag set:
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, textureWidth, textureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
and the whole program has
The images I am trying to load on the FBO are PNG with an alpha.
The result so far is that when I run the program the FBO has the various PNGs but also a black background (due the glClear) that enterely covers what’s behind. If I use glBlendFunc(GL_ONE, GL_ONE) while drawing on the FBO then when I render it on top of the main FBO it works fine… but I dont like the adding mode.
Could someone explain me how to correctly draw on a FBO using the alpha channel to mask only the drawn regions?