summaryrefslogtreecommitdiff
path: root/menuApp/src
diff options
context:
space:
mode:
authortim <tim@eclectronics.org>2017-06-12 23:17:46 +0100
committertim <tim@eclectronics.org>2017-06-12 23:17:46 +0100
commitfd37c61cd45c1c7a4786b12db8140680772cb1be (patch)
treee7e036a11de58289c152139a464c8fbf1d9ee431 /menuApp/src
parentb2e4d58259d8e4ca744d40ad53bb3ca5e3d0ed3d (diff)
possible grabbing fix by rotation
Diffstat (limited to 'menuApp/src')
-rw-r--r--menuApp/src/main.cpp6
-rw-r--r--menuApp/src/ofApp.cpp22
2 files changed, 24 insertions, 4 deletions
diff --git a/menuApp/src/main.cpp b/menuApp/src/main.cpp
index 3c31279..733814a 100644
--- a/menuApp/src/main.cpp
+++ b/menuApp/src/main.cpp
@@ -3,8 +3,10 @@
//========================================================================
int main( ){
- int width=(1920*FACTOR*sin(ROTATION))+(1080*FACTOR*cos(ROTATION));
- int height=(1920*FACTOR*cos(ROTATION))+(1080*FACTOR*sin(ROTATION));
+ float rotation=ofDegToRad(ROTATION);
+ int width=(1920*FACTOR*sin(rotation))+(1080*FACTOR*cos(rotation));
+ int height=(1920*FACTOR*cos(rotation))+(1080*FACTOR*sin(rotation));
+
#ifdef FULLSCREEN
ofSetupOpenGL(width,height,OF_FULLSCREEN);
#else
diff --git a/menuApp/src/ofApp.cpp b/menuApp/src/ofApp.cpp
index ce141de..81350ac 100644
--- a/menuApp/src/ofApp.cpp
+++ b/menuApp/src/ofApp.cpp
@@ -186,6 +186,14 @@ void ofApp::draw(){
loadInstagramFeed();
}
+ofPushMatrix();
+
+ if(ROTATION>0){
+ ofTranslate(540*FACTOR,960*FACTOR);
+ ofRotate(-ROTATION);
+ ofTranslate(-120*FACTOR,-540*FACTOR);
+ }
+
ofPushMatrix(); //Store the coordinate system nexessary for some reason
background.draw(0,0,1080*FACTOR,1920*FACTOR); //ofGetWidth(),ofGetHeight());
ofPopMatrix(); //Restore the coordinate system
@@ -242,7 +250,17 @@ ofPopMatrix(); //Restore the coordinate system
//hence the "primed" mechanism
if (primed){
ofImage img;
- img.grabScreen(0, 0,1080*FACTOR,1920*FACTOR);
+ //float rotation=ofDegToRad(ROTATION);
+ //int width=(1920*FACTOR*sin(rotation))+(1080*FACTOR*cos(rotation));
+ //int height=(1920*FACTOR*cos(rotation))+(1080*FACTOR*sin(rotation));
+ img.grabScreen(0, 0,1920*FACTOR,1920*FACTOR);
+ if(ROTATION>0){
+ img.rotate90(1);
+ img.crop(860*FACTOR,0,1080*FACTOR,1920*FACTOR);
+ }
+ else {
+ img.crop(0,0,1080*FACTOR,1920*FACTOR);
+ }
img.save(SCREENGRABFILEPATH);
primed=false;
}
@@ -252,7 +270,7 @@ ofPopMatrix(); //Restore the coordinate system
isGrabbed=true;
}
-
+ofPopMatrix();
}