OpenFrameworks Brush Tool Implementation

678 Views Asked by At

I am working on Open Frameworks.

I have made an application that extracts the face of the user from the live feed and projects it on a rectangle of chosen colour. Now I want the user to be able to draw something in the background of the face. To do that I need to implement a brush tool.

Problems faced:

  1. If I set the ofSetBackgroundAuto() to false, the face does not refresh from the next frame.
  2. If ofSetBackgroundAuto is set to true, then the brush doesn't draw, because the background is again and again refreshed.

Please help !!

1

There are 1 best solutions below

0
On

You can use a frame buffer object ofFbo https://github.com/openframeworks/openFrameworks/blob/master/libs/openFrameworks/gl/ofFbo.h

ofFbo fbo;
setup(){
    fbo.allocate(ofGetWidth(), ofGetHeight());
}

draw(){
    fbo.begin();
    //draw your brush
    fbo.end();

    fbo.draw();

    //draw face
}