summaryrefslogtreecommitdiff
path: root/keyshade/src/ofApp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'keyshade/src/ofApp.cpp')
-rw-r--r--keyshade/src/ofApp.cpp15
1 files changed, 8 insertions, 7 deletions
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())
);
}