c++mappingopacityopenframeworksfbo

In openFrameworks, is it possible to change the opacity of my fbo sources while using ofxPiMapper?


In openFrameworks, is it possible to change the opacity of my fbo sources while using ofxPiMapper?


Solution

  • Figured it out:

    Go into addons/ofxPiMapper/src/Surfaces/SurfaceStack.cpp In SurfaceStack::draw(), add ofEnableAlphaBlending() to the if statement inside the for loop right under all the glblend stuff.

    void SurfaceStack::draw(){
        for(int i = 0; i < _surfaces.size(); ++i){
            if(_surfaces[i]->getSource()->getType() == SourceType::SOURCE_TYPE_FBO){
                glEnable(GL_BLEND); 
                glBlendFuncSeparate(GL_ONE, GL_ZERO, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
                ofEnableAlphaBlending(); //<-- here
            }else{
                ofEnableAlphaBlending();
            }
            _surfaces[i]->draw();
        }
    }