Browse Source

Alpha masking without shaders for RPi

master
c-mendoza 8 years ago
parent
commit
e73f8624d0
  1. 22
      example/src/main.cpp
  2. 19
      src/Surfaces/CircleSurface.cpp

22
example/src/main.cpp

@ -15,24 +15,8 @@ int main(int argc, char * argv[]){
}
}
shared_ptr<ofAppBaseWindow> window;
#ifdef TARGET_OPENGLES
ofGLESWindowSettings esSettings;
esSettings.glesVersion = 2;
esSettings.width = 1440;
esSettings.height = 900;
window = ofCreateWindow(esSettings);
#else
ofGLWindowSettings glSettings;
glSettings.glVersionMajor = 2;
glSettings.glVersionMinor = 1;
glSettings.width = 1440;
glSettings.height = 900;
window = ofCreateWindow(glSettings);
#endif
auto app = std::make_shared<ofApp>();
Settings::instance()->setFullscreen(fullscreen);
ofRunApp(window, app);
ofRunMainLoop();
ofSetupOpenGL(1024, 768, OF_WINDOW);
ofRunApp(new ofApp());
}

19
src/Surfaces/CircleSurface.cpp

@ -183,6 +183,23 @@ void CircleSurface::draw() {
ofClear(0, 0, 0, 0);
ofSetupScreenOrtho(w, h, -1, 1);
ofEnableNormalizedTexCoords();
ofSetColor(255);
ofFill();
ofSetRectMode(OF_RECTMODE_CORNER);
#ifdef TARGET_RASPBERRY_PI
scaledSourceFbo.getTexture().bind();
maskMesh.draw();
scaledSourceFbo.getTexture().unbind();
// Masking without shaders...
ofPushStyle();
ofEnableBlendMode(OF_BLENDMODE_MULTIPLY);
ofSetColor(255);
ofFill();
ofDisableNormalizedTexCoords();
maskFbo.draw(0, 0);
ofPopStyle();
#else
maskShader.begin();
maskShader.setUniformTexture("maskTex", maskFbo.getTexture(), 1);
ofSetColor(255);
@ -192,6 +209,8 @@ void CircleSurface::draw() {
maskMesh.draw();
scaledSourceFbo.getTexture().unbind();
maskShader.end();
#endif
}
outputFbo.end();

Loading…
Cancel
Save