diff options
Diffstat (limited to 'TRRSS_01_rec/src/testApp.cpp')
| -rwxr-xr-x | TRRSS_01_rec/src/testApp.cpp | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/TRRSS_01_rec/src/testApp.cpp b/TRRSS_01_rec/src/testApp.cpp index ddd543f..6e8533a 100755 --- a/TRRSS_01_rec/src/testApp.cpp +++ b/TRRSS_01_rec/src/testApp.cpp @@ -54,7 +54,20 @@ void testApp::setup(){ openNIDevice.setLogLevel(OF_LOG_VERBOSE); openNIDevice.addDepthGenerator(); openNIDevice.addImageGenerator(); // comment this out + openNIDevice.addUserGenerator(); + openNIDevice.setRegister(true); + openNIDevice.setMirror(true); openNIDevice.start(); + + openNIDevice.setMaxNumUsers(1); + ofAddListener(openNIDevice.userEvent, this, &testApp::userEvent); + + ofxOpenNIUser user; + user.setUseMaskTexture(true); + user.setUsePointCloud(true); + user.setPointCloudDrawSize(2); // this is the size of the glPoint that will be drawn for the point cloud + user.setPointCloudResolution(2); // this is the step size between points for the cloud -> eg., this sets it to every second point + openNIDevice.setBaseUserClass(user); #else recordContext.setup(); recordDepth.setup(&recordContext); @@ -90,7 +103,24 @@ void testApp::draw(){ //openNIDevice.drawDebug(); // draws all generators //openNIDevice.drawDepth(0, 0); - openNIDevice.drawImage(0, 0,ofGetWidth(),ofGetHeight()); + if (guiWin->drawPoints) { + ofPushMatrix(); + ofEnableBlendMode(OF_BLENDMODE_ALPHA); + int numUsers = openNIDevice.getNumTrackedUsers(); + for (int nID = 0; nID < numUsers; nID++){ + ofxOpenNIUser & user = openNIDevice.getTrackedUser(nID); + user.drawMask(); + ofPushMatrix(); + ofTranslate((1024/2)-(640/2),(768/2)-(480/2),-500); + user.drawPointCloud(); + ofPopMatrix(); + } + ofDisableBlendMode(); + ofPopMatrix(); + } + else { + openNIDevice.drawImage(0, 0,ofGetWidth(),ofGetHeight()); + } #else //cam.begin(); @@ -174,7 +204,11 @@ void testApp::draw(){ #endif } - +#ifdef NEWAPI +void testApp::userEvent(ofxOpenNIUserEvent & event){ + ofLogNotice() << getUserStatusAsString(event.userStatus) << "for user" << event.id << "from device" << event.deviceID; +} +#endif void testApp::exit(){ #ifdef NEWAPI openNIDevice.stop(); |
