FBO & glBlendFunc Troubles

Hi All,

I have two cameras set up and I’m combining both of their feeds using multiplicative blending with


Which works fine on its own and the images blend nicely. However if I try to draw the result into a FBO, I get a black screen.

I’ve seen a number of other posts describing problems with doing alpha transparency things in FBO’s, but I don’t need any transparency. Perhaps there is an easy solution to this? Would I be better off just writing a little shader to do the blending?

The code is super simple.

void testApp::setup(){  
    cam1.initGrabber(1024, 768);  
    cam2.initGrabber(1024, 768);  
    fbo.allocate(1024, 768, GL_RGB);  
    glBlendFunc(GL_DST_COLOR, GL_ZERO);  
void testApp::update(){  
void testApp::draw(){  

Thanks for the help!

fbo.allocate(1024, 768, GL_RGBA); // with alpha, 8 bits red, 8 bits green, 8 bits blue, 8 bits alpha, from 0 to 255 in 256 steps
fbo.allocate(1024, 768, GL_RGBA32F_ARB); // with alpha, 32 bits red, 32 bits green, 32 bits blue, 32 bits alpha, from 0 to 1 in ‘infinite’ steps

Hmm, no dice with either of those, but thanks for the response!

I think I may have to call the glblend within the fbo itself.

I tried a number of random combinations, glBlendFunc(GL_SRC_COLOR, GL_SRC_COLOR); draws and blends the two cams together, but not quite in the way that I’d like. The second image appears somewhat transparent.

Can anyone explain why the FBO seems to be performing some additional blending of it’s own? Is there a way to turn that off?

Try to clear your fbo
here, I think you want to do it in your draw()

	ofClear(255,255,255, 0);  

also try disabling the blending before drawing the fbo to the screen then enabling it again when drawing the videos to the fbo.

Thank you for the responses everyone! The ofClear(255,255,255,0) did the trick!