diff options
| author | Comment <tim@gray.(none)> | 2013-06-17 00:40:52 +0100 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2013-06-17 00:40:52 +0100 |
| commit | 4f4662fba0c22c91c17eeea436d566398f8e5779 (patch) | |
| tree | 718c7159b0bae31b425741af9b1732ebb6af714b /03_play/src/testApp.cpp | |
| parent | f714b852416caeaa20c91c9b0336a7d067e28ddb (diff) | |
much done: al lot more to do
Diffstat (limited to '03_play/src/testApp.cpp')
| -rw-r--r-- | 03_play/src/testApp.cpp | 75 |
1 files changed, 72 insertions, 3 deletions
diff --git a/03_play/src/testApp.cpp b/03_play/src/testApp.cpp index 6d10c0d..5553bc8 100644 --- a/03_play/src/testApp.cpp +++ b/03_play/src/testApp.cpp @@ -72,17 +72,86 @@ void testApp::draw(){ ofBackground(0, 0, 0); ofSetColor(255, 255, 255); + + ofPushMatrix(); + //ofTranslate(0,0,-1500); + ofRotate(0,1,0,180); + + //cam.begin(); + + ofDrawAxis(100); + + //glEnable(GL_PROGRAM_POINT_SIZE); + //glEnable(GL_POINT_SMOOTH); + //glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); + + //glPointSize(12.0f); for (int deviceID = 0; deviceID < numDevices; deviceID++){ - ofTranslate(0, deviceID * 400); + //ofTranslate(0, deviceID * 400); //openNIPlayers[deviceID].drawDebug(); - openNIPlayers[deviceID].drawDepth(50, 0,520,390); - openNIPlayers[deviceID].drawImage(600, 0,520,390); + //openNIPlayers[deviceID].drawDepth(50, 0,520,390); + //openNIPlayers[deviceID].drawImage(600, 0,520,390); + + //construct points + //glBegin(GL_POINTS); + //how to find buffer size? + /* + XnStatus xn::DepthGenerator::ConvertProjectiveToRealWorld ( XnUInt32 nCount, + const XnPoint3D aProjective[], + XnPoint3D aRealWorld[] + ) + */ + + int count; + const XnDepthPixel* depthmap=openNIPlayers[deviceID].getDepthGenerator().GetDepthMap(); + int range=2000; + + int dmw=openNIPlayers[deviceID].getWidth(); + + for (int i=0;i<openNIPlayers[deviceID].getWidth();i+=2) { + + glBegin(GL_LINES); + + for (int j=0;j<openNIPlayers[deviceID].getHeight();j+=2) { + + + + ofPoint p= openNIPlayers[deviceID].projectiveToWorld(ofPoint(i,j,(float)depthmap[j*dmw+i])); + //ofPoint p= projectiveToWorld(ofPoint(i,j,(float)depthmap[j*dmw+i])); + + if (p.z == 0 || p.z>range) continue; // gets rid of background -> still a bit weird if userID > 0... //&& isCPBkgnd + //ofColor color = kinect->getColorAt(x,y); //userID); + //if (col) glColor4ub((unsigned char)color.r, (unsigned char)color.g, (unsigned char)color.b, (unsigned char)color.a); + // else + + + glColor4ub((unsigned char)255, (unsigned char)255, (unsigned char)255, (unsigned char)255); + glVertex3f(p.x, p.y, p.z); + //if (i==320&&j==160) cerr<<"world point: "<<p.x<<","<<p.y<<","<<p.z<<endl; + } + + glEnd(); + } } + //export for fast/ switchable playback + //figure out how to line up (could be one off) + //export frame and find matching coords + //manually find positions + //calculate offset + //audio sync + //gui + //audio analysis + //sfx for point cloud + + //cam.end(); + ofPopMatrix(); + glDisable(GL_PROGRAM_POINT_SIZE); + ofSetColor(255, 255, 255); string msg = "MILLIS: " + ofToString(ofGetElapsedTimeMillis()); msg += "\nFPS: " + ofToString(ofGetFrameRate()); |
