Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Background with an OF_BLENDMODE_SUBTRACT mask

$
0
0

@seldon wrote:

Hello, I find this code in the forum to make a mask with ofCircle over a image:

But in my Project this code is in a Class that is called from other draw() method with another background.

I try but I can't find how can disable the ofBackground(0) and make it transparent.

any help will be very useful

void ofApp::setup(){
  image.loadImage("imagen.jpg");
 fbo.allocate(image.width, image.height);
 fbo2.allocate(image.width, image.height);
}

void ofApp::draw(){
 ofBackground(0);
 ofSetColor(255, 255, 255);

fbo.begin();
    ofClear(0, 0, 0, 0);
    image.draw(0, 0);
fbo.end();

fbo2.begin();
    ofClear(0, 0, 0, 0);
    ofSetColor(255, 255, 255);
    ofCircle(mouseX , mouseY, 200);
fbo2.end();

fbo.draw(0, 0);
ofEnableBlendMode(OF_BLENDMODE_SUBTRACT);
fbo2.draw(0, 0);
ofDisableBlendMode();
}

thank very much.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles