alptugan
5/28/2019 - 5:41 PM

mask_ofImage_with_fbo

void ofApp::setup() 
{
  image.load("img.jpg");
  fbo.allocate(image.getWidth(), image.getHeight(), GL_RGBA,4); //GL_LUMINANCE depends on your GL version
  fbo.begin();
  ofClear(0,0);
  ofDrawEllipse(100, 100, 200, 200);
  fbo.end();
  
  // Do the trick
  image.getTexture().setAlphaMask(fbo.getTexture());
}

void ofApp:draw() {
  image.draw(0, 0);
}