diff options
Diffstat (limited to 'TRRSS_01_rec/src/testApp.cpp')
| -rwxr-xr-x | TRRSS_01_rec/src/testApp.cpp | 58 |
1 files changed, 46 insertions, 12 deletions
diff --git a/TRRSS_01_rec/src/testApp.cpp b/TRRSS_01_rec/src/testApp.cpp index 6e8533a..a052ccc 100755 --- a/TRRSS_01_rec/src/testApp.cpp +++ b/TRRSS_01_rec/src/testApp.cpp @@ -50,7 +50,7 @@ void unbindTex(ofTexture &tex) { //-------------------------------------------------------------- void testApp::setup(){ #ifdef NEWAPI - openNIDevice.setup();//FromXML("openni/config/ofxopenni_config.xml"); + openNIDevice.setup(false);//FromXML("openni/config/ofxopenni_config.xml"); openNIDevice.setLogLevel(OF_LOG_VERBOSE); openNIDevice.addDepthGenerator(); openNIDevice.addImageGenerator(); // comment this out @@ -59,15 +59,21 @@ void testApp::setup(){ openNIDevice.setMirror(true); openNIDevice.start(); + openNIDevice.setUseDepthRawPixels(true); + + //openNIDevice.setSafeThreading(true); ?slower and still crashes? + 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 + user.setPointCloudDrawSize(1); // this is the size of the glPoint that will be drawn for the point cloud + user.setPointCloudResolution(1); // 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); @@ -101,22 +107,50 @@ void testApp::draw(){ #ifdef NEWAPI ofSetColor(255, 255, 255); + + //openNIDevice.drawDebug(); // draws all generators //openNIDevice.drawDepth(0, 0); + if (guiWin->drawPoints) { + +/* + glEnable( GL_POINT_SMOOTH ); + glEnable( GL_BLEND ); + glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); + glPointSize( guiWin->pointSize ); + + glBegin(GL_POINTS); + glColor3f( 1.0f, 1.0f, 1.0f ); + + + //uint16_t *depth=openNIDevice.getDepthRawPixels().getPixels(); + ofPoint p; + for (int i=0;i<640;i+=guiWin->drawStep){ + for (int j=0;j<480;j+=guiWin->drawStep){ + p=openNIDevice.cameraToWorld(ofVec2f(i,j)); + glVertex3f(p.x,p.y,p.z); + } + } +*/ + + 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(); + 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()); |
