From a2c532b9d1e7dc88c56b33aa074ef1a9b9e342e7 Mon Sep 17 00:00:00 2001 From: c-mendoza Date: Fri, 8 Nov 2019 11:48:39 -0500 Subject: [PATCH] Fix for the CircleSurface mask --- src/Surfaces/CircleSurface.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) mode change 100644 => 100755 src/Surfaces/CircleSurface.cpp diff --git a/src/Surfaces/CircleSurface.cpp b/src/Surfaces/CircleSurface.cpp old mode 100644 new mode 100755 index b0801fb..e8a5c0d --- a/src/Surfaces/CircleSurface.cpp +++ b/src/Surfaces/CircleSurface.cpp @@ -151,10 +151,9 @@ void CircleSurface::draw() { // if (source->getType() == SOURCE_TYPE_FBO || // source->getType() == SOURCE_TYPE_VIDEO || // lastSourceTextureId == UINT_MAX) { - if (true) { - lastSourceTextureId = sourceTexId; - drawMaskForSource(sourceTex); - } + + lastSourceTextureId = sourceTexId; + drawMaskForSource(sourceTex); // Swap the texture id of the source with the one of our // newly drawn outputFbo: @@ -202,7 +201,8 @@ void CircleSurface::drawMaskForSource(ofTexture &sourceTex) { sourceTex.unbind(); // Masking without shaders... ofPushStyle(); - ofEnableBlendMode(OF_BLENDMODE_MULTIPLY); + glEnable(GL_BLEND); + glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA); ofSetColor(255); ofFill(); ofDisableNormalizedTexCoords(); @@ -241,7 +241,7 @@ void CircleSurface::setupTextures() { maskFbo.begin(false); ofPushStyle(); ofSetupScreenOrtho(w, h, -1, 1); - ofClear(0, 0, 0, 255); + ofClear(0, 0, 0, 0); ofFill(); ofSetColor(255); ofSetCircleResolution(300); @@ -251,7 +251,7 @@ void CircleSurface::setupTextures() { outputFbo.allocate(w, h); outputFbo.begin(); - ofClear(0, 0, 0, 255); + ofClear(0, 0, 0, 0); outputFbo.end(); // scaledSourceFbo.allocate(w, h);