From a4b2c2a0c569f6732ead116f7cbc3dae0fc999a0 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Thu, 19 Oct 2017 07:39:51 +0100 Subject: basically it --- keyshade/src/ofApp.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'keyshade/src/ofApp.cpp') diff --git a/keyshade/src/ofApp.cpp b/keyshade/src/ofApp.cpp index 9adae87..588557a 100644 --- a/keyshade/src/ofApp.cpp +++ b/keyshade/src/ofApp.cpp @@ -4,7 +4,7 @@ void ofApp::setup(){ shader.load("shader"); backgroundImage.load("../../../gui/bin/data/funfair/IMG_2893.JPG"); - foregroundImage.load("../../../gui/bin/data/funfair/IMG_2894.JPG"); + foregroundImage.load("../../../gui/bin/data/funfair/IMG_2890.JPG"); maskFbo.allocate(ofGetWidth(), ofGetHeight()); @@ -14,8 +14,8 @@ void ofApp::setup(){ ofClear(0,0,0,255); maskFbo.end(); - keyMinDist=0.2f; - keyMaxDist=0.3f; + keyMinDist=0.1f; + keyMaxDist=0.2f; keyColour=ofColor(200,40,0); } @@ -34,7 +34,8 @@ void ofApp::draw(){ shader.begin(); shader.setUniform4f("keyColour",keyColour); shader.setUniform1f("keyMinDist",keyMinDist); - shader.setUniform4f("keyMaxDist",keyMaxDist); + shader.setUniform1f("keyMaxDist",keyMaxDist); + shader.setUniform1f("time",2.0f+sin(ofGetElapsedTimef())); shader.setUniformTexture("backgroundTex", backgroundImage.getTexture(), 1 ); shader.setUniformTexture("foregroundTex", foregroundImage.getTexture(), 2 ); @@ -65,9 +66,9 @@ void ofApp::mouseDragged(int x, int y, int button){ //-------------------------------------------------------------- void ofApp::mousePressed(int x, int y, int button){ - keyColour = backgroundImage.getColor( - x*(backgroundImage.getWidth()/ofGetWidth()), - y*(backgroundImage.getHeight()/ofGetHeight()) + keyColour = foregroundImage.getColor( + x*(foregroundImage.getWidth()/ofGetWidth()), + y*(foregroundImage.getHeight()/ofGetHeight()) ); } -- cgit v1.2.3