Save screenshot using FBO but background always transparent?

Hi, I am trying to save a screenshot to disk using an FBO but the background is always transparent. I’m sure I’m missing something simple.

Here is the code. (Note that I want to save screenshot at higher resolution than the screen, so grabScreen / ofSaveScreen won’t work for me- at least i don’t think so!)

void ofApp::setup(){
    screenshotFbo.allocate(3840, 2160);
void ofApp::draw(){
    if ( isCurrentlySavingScreenshot ) {
        ofClear(255, 255, 255, 0);

    ofDrawCircle(ofGetWidth() / 2, ofGetHeight() / 2, seqRadius);

    if ( isCurrentlySavingScreenshot ) {

        // capture 4K screenshot!
        ofPixels pixels;
        ofImage img;

        ofSaveImage(img, "screenshot " + ofGetTimestampString() + ".png");
        isCurrentlySavingScreenshot = false;

        screenshotFbo.draw(0, 0);
void ofApp::keyPressed(int key){
    if ( key == 'x' ) {
        // screenshot!
        isCurrentlySavingScreenshot = true;


thats the reason. the last value is the alpha value of the colour you clear the fbo with. just remove it if you want a whitie background. of pass in any color you want. e.g. ofClear(ofColor::pink), ofClear(ofColor(255,0,0)).
it should probably be the same background colour your app use.
hope that helps

1 Like

Thank you!