Drawing FBOs with additive blend mode

I’m trying to draw some FBOs I have, layering them on top of each-other using the ‘add’ blend mode but I’m not seeing any blending happening.

Here is a simple example that draws two fbos, each containing a different coloured circle. I see them appear overlapping each-other, but the blend mode has no effect:

ofBackground( 0 );

ofFbo testFbo1;
testFbo1.allocate( 200, 200, GL_RGBA );
ofFbo testFbo2;
testFbo2.allocate( 200, 200, GL_RGBA );

testFbo1.begin();
    ofClear( 0, 0, 0, 0 );
    ofSetColor( 150, 0, 0 );
    ofCircle( 20, 20, 20 );
testFbo1.end();
testFbo2.begin();
    ofClear( 0, 0, 0, 0 );
    ofSetColor( 0, 0, 150 );
    ofCircle( 30, 20, 20 );
testFbo2.end();

ofSetColor( 255 );

ofEnableBlendMode( OF_BLENDMODE_ADD );

testFbo1.draw( 100, 100 );
testFbo2.draw( 100, 100 );

ofDisableBlendMode();

I feel maybe I’m mis-understanding something basic here with how blend modes or FBOs work, can anyone point me in the right direction?

The code looks fine. I just pasted this into a new project and it worked for me. Have you tried the blending example that comes with OF?

Aha! You just made me realise I had a stray ‘ofEnableSmoothing()’ elsewhere in my project that was for some reason breaking this (although not breaking blending outside of FBOs).

Thanks for helping :smile: