summaryrefslogtreecommitdiff
path: root/keyshade/src
diff options
context:
space:
mode:
authorTim Redfern <tim@getdrop.com>2017-10-19 07:39:51 +0100
committerTim Redfern <tim@getdrop.com>2017-10-19 07:39:51 +0100
commita4b2c2a0c569f6732ead116f7cbc3dae0fc999a0 (patch)
tree5ba644745817528e496f0b161d5f3edd784c08af /keyshade/src
parenta3c99df80c201e56a32eb5fe650d45e9a9ccaee2 (diff)
basically it
Diffstat (limited to 'keyshade/src')
-rw-r--r--keyshade/src/ofApp.cpp15
-rw-r--r--keyshade/src/ofApp.h11
2 files changed, 19 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())
);
}
diff --git a/keyshade/src/ofApp.h b/keyshade/src/ofApp.h
index 8774291..b9c5f19 100644
--- a/keyshade/src/ofApp.h
+++ b/keyshade/src/ofApp.h
@@ -5,6 +5,17 @@
/*
click on the image to choose a colour (maybe draw a line or outline a range of colours?)
+works really well. now, how to appy a transform
+
+this approach maps the whole image onto the whole screen.
+the texcoords come from the vertex shader?
+I suppose that it's necessary to add extra transforms and extract
+extra texcoords from the vertex shader
+
+although it'd be possible to use a simplistic shader in this way
+and create the scaled textures normally as Fbos
+
+need a tutorial on transforming textures using the GPU
*/
class ofApp : public ofBaseApp{