Skip to content

Commit

Permalink
added '049_interactLinesKinect'
Browse files Browse the repository at this point in the history
  • Loading branch information
Lewis Lepton committed Dec 17, 2019
1 parent 1832f94 commit 661117a
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 0 deletions.
1 change: 1 addition & 0 deletions 049_interactLinesKinect/addons.make
@@ -0,0 +1 @@
ofxKinect
13 changes: 13 additions & 0 deletions 049_interactLinesKinect/src/main.cpp
@@ -0,0 +1,13 @@
#include "ofMain.h"
#include "ofApp.h"

//========================================================================
int main( ){
ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context

// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
// pass in width and height too:
ofRunApp(new ofApp());

}
90 changes: 90 additions & 0 deletions 049_interactLinesKinect/src/ofApp.cpp
@@ -0,0 +1,90 @@
#include "ofApp.h"

//--------------------------------------------------------------
void ofApp::setup(){
kinect.init();
kinect.open(); //id missed inputting this in episode 049s recording.
}

//--------------------------------------------------------------
void ofApp::update(){
kinect.update();
}

//--------------------------------------------------------------
void ofApp::draw(){
kinect.draw(0, 0, 640, 480);
for (int i = 0; i < kinect.getWidth(); i += 16) {
for (int j = 0; j < kinect.getHeight(); j += 16) {
ofColor color = kinect.getPixels().getColor(i, j);
float brightness = color.getBrightness();
ofPushMatrix();
ofTranslate(i, j);
ofRotateZDeg(ofMap(brightness, 0, 255, 0, 360));
// ofSetLineWidth(ofMap(brightness, 0, 255, 16, 0));
ofDrawLine(0 - 8, 0, 0 + 8, 0);
ofDrawLine(0, 0 - 8, 0, 0 + 8);
ofPopMatrix();
}
}
}

void ofApp::exit(){
kinect.close();
kinect.setCameraTiltAngle(0);
}

//--------------------------------------------------------------
void ofApp::keyPressed(int key){
kinect.setCameraTiltAngle(0);
}

//--------------------------------------------------------------
void ofApp::keyReleased(int key){

}

//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){

}

//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){

}

//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){

}

//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){

}

//--------------------------------------------------------------
void ofApp::mouseEntered(int x, int y){

}

//--------------------------------------------------------------
void ofApp::mouseExited(int x, int y){

}

//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){

}

//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){

}

//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){

}
28 changes: 28 additions & 0 deletions 049_interactLinesKinect/src/ofApp.h
@@ -0,0 +1,28 @@
#pragma once

#include "ofMain.h"
#include "ofxKinect.h"

class ofApp : public ofBaseApp{

public:
void setup();
void update();
void draw();
void exit();

void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void mouseEntered(int x, int y);
void mouseExited(int x, int y);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);

ofxKinect kinect;

};

0 comments on commit 661117a

Please sign in to comment.