#include "testApp.h" //-------------------------------------------------------------- void testApp::setup() { ofSetLogLevel(OF_LOG_NOTICE); verdana.loadFont(ofToDataPath("verdana.ttf"), 10); playing=0; numDevices=2; string filename="TRSS_nesbitt_recordings.xml"; if( !XML.loadFile(filename) ){ printf("unable to load recordings, check data/ folder\n"); }else{ if(XML.pushTag("TRSS")) { int num=XML.getNumTags("rec"); if(num) { for (int i=0;i eg., this sets it to every second point for (int deviceID = 0; deviceID < numDevices; deviceID++){ //openNIPlayers[deviceID].stop(); openNIPlayers[deviceID].setup(true); openNIPlayers[deviceID].addUserGenerator(); openNIPlayers[deviceID].setRegister(true); openNIPlayers[deviceID].start(); openNIPlayers[deviceID].setBaseUserClass(user); //openNIPlayers[deviceID].startPlayer(ofToDataPath(recs[playing][deviceID])); } soundplayer.setLoop(false); startPlayers(); //ofSetFrameRate(25.0f); offset=0.0f; drawmovies=false;drawcloud=true; frame=0; } void testApp::startPlayers(){ for (int deviceID = 0; deviceID < numDevices; deviceID++){ //openNIPlayers[deviceID].stop(); //openNIPlayers[deviceID].setup(false); //openNIPlayers[deviceID].start(); openNIPlayers[deviceID].startPlayer(ofToDataPath(recs[playing].data[deviceID])); openNIPlayers[deviceID].setSpeed(0.01f); //openNIPlayers[deviceID].setPaused(true); soundplayer.stop(); if (recs[playing].audio!=""){ soundplayer.loadSound(recs[playing].audio); soundplayer.play(); soundplayer.setPosition(offset); } } } //-------------------------------------------------------------- void testApp::update(){ for (int deviceID = 0; deviceID < numDevices; deviceID++){ openNIPlayers[deviceID].setFrame(frame); openNIPlayers[deviceID].update(); } } //-------------------------------------------------------------- void testApp::draw(){ ofBackground(50, 50, 50); ofSetColor(255, 255, 255); //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++){ if (drawmovies) { ofTranslate(0, deviceID * 400); //openNIPlayers[deviceID].drawDebug(); 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[] ) */ if (drawcloud) { cam.begin(); ofPushMatrix(); ofRotate(0,1,0,180); ofTranslate(0,0,1500); ofDrawAxis(100); int count; const XnDepthPixel* depthmap=openNIPlayers[deviceID].getDepthGenerator().GetDepthMap(); int range=2500; int dmw=openNIPlayers[deviceID].getWidth(); for (int i=0;irange) 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: "<