Hello, I’m developing a graphics program and I’m having issues with transparencies.
According to this, if you want to draw an FBO on the screen, you must to this:
void draw()
{
// draw image on FBO
textureFbo.begin();
ofEnableAlphaBlending();
image.draw(0, 0);
ofDisableAlphaBlending();
textureFbo.end();
// draw FBO on screen
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
textureFbo.draw(0,0);
glDisable(GL_BLEND);
}
However, that code isn't working to me, because I'm doing something more complicated. I'm drawing videos on an FBO, and then draw them on another FBO, and then draw them on a quad (ofxGLWarper).
void draw()
{
// draw videos on a scene FBO
sceneFbo->begin();
drawVideos ();
sceneFbo->end ();
// draw the scene FBO on a second FBO
alphaFbo->begin();
sceneFbo->draw(0, 0);
alphaFbo->end();
// draw the second FBO on a quad
quad->begin();
alphaFbo->draw(0, 0);
quad->end();
}
Actually it’s even more complicated, because I don’t just draw videos in the scene, but also more FBOs. And the alphaFbo may use an alpha mask.
So I'm trying different combinations of glEnable, glBlendFunc and glEnableAlphaBlending but they don't work.
``
Any suggestions on how to draw an FBO in an FBO with transparencies? Or where can I learn about blending functions? Thanks!