summaryrefslogtreecommitdiff
path: root/04_playobjects
diff options
context:
space:
mode:
authorTim <tim@Admins-Mac-Pro-2.local>2013-06-18 18:03:31 +0100
committerTim <tim@Admins-Mac-Pro-2.local>2013-06-18 18:03:31 +0100
commitc42c63d30a31713ffc113d6a03795d4538bd5c84 (patch)
tree1179a7ad4946734b9fcfd14c4246ef7c8752df4e /04_playobjects
parent020abd861215e391c6664c1f63d4dc0cf2fab833 (diff)
mostly good
Diffstat (limited to '04_playobjects')
-rw-r--r--04_playobjects/src/testApp.cpp18
-rw-r--r--04_playobjects/src/testApp.h23
2 files changed, 35 insertions, 6 deletions
diff --git a/04_playobjects/src/testApp.cpp b/04_playobjects/src/testApp.cpp
index 6b525e1..c1850f9 100644
--- a/04_playobjects/src/testApp.cpp
+++ b/04_playobjects/src/testApp.cpp
@@ -33,6 +33,13 @@ void testApp::setup() {
offset=0.0f;
receiver.setup(OSCPORT);
+
+ 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
+
+ drawmovies=false;drawcloud=true;
}
void testApp::startPlayers(int newplayer){
@@ -40,7 +47,7 @@ void testApp::startPlayers(int newplayer){
soundplayer.stop();
usleep(100000);
playing=newplayer;
- players[playing].play();
+ players[playing].play(user);
}
//--------------------------------------------------------------
@@ -75,7 +82,8 @@ void testApp::draw(){
ofPushMatrix();
- players[playing].draw();
+ if (drawmovies) players[playing].drawWindows();
+ if (drawmovies) players[playing].drawCloud();
ofPopMatrix();
@@ -111,6 +119,12 @@ void testApp::keyPressed(int key){
case 'x':
offset+=1;
break;
+ case 'q':
+ drawmovies=!drawmovies;
+ break;
+ case 'w':
+ drawcloud=!drawcloud;
+ break;
}
if (newplaying!=playing) startPlayers(newplaying);
}
diff --git a/04_playobjects/src/testApp.h b/04_playobjects/src/testApp.h
index 223bc9d..0de2207 100644
--- a/04_playobjects/src/testApp.h
+++ b/04_playobjects/src/testApp.h
@@ -35,12 +35,15 @@ class syncOniPlayer{
//players[players.size()-1]->start();
//players[players.size()-1]->startPlayer(name);
}
- void play(){
+ void play(ofxOpenNIUser user){
for (int i=0;i<players.size();i++) {
players[i]=new ofxOpenNI();
//players[i]->setSafeThreading(true);
players[i]->setupFromONI(filenames[i],true);
+ players[i]->addUserGenerator();
+ players[i]->setRegister(true);
players[i]->setLooped(false);
+ players[i]->setBaseUserClass(user);
players[i]->start();
//players[players.size()-1]->setSpeed(1.0f);
if (audio!="") {
@@ -69,9 +72,19 @@ class syncOniPlayer{
}
void drawCloud(){
for (int i=0;i<players.size();i++) {
- ofTranslate(0, i * 400);
- players[i]->drawDepth(50, 0,520,390);
- players[i]->drawImage(600, 0,520,390);
+ ofPushMatrix();
+ ofEnableBlendMode(OF_BLENDMODE_ALPHA);
+ int numUsers = players[i]->getNumTrackedUsers();
+ for (int nID = 0; nID < numUsers; nID++){
+ ofxOpenNIUser & user = players[i]->getTrackedUser(nID);
+ user.drawMask();
+ ofPushMatrix();
+ ofTranslate(ofGetWidth()/2, ofGetHeight()/2, -1000);
+ user.drawPointCloud();
+ ofPopMatrix();
+ }
+ ofDisableBlendMode();
+ ofPopMatrix();
}
}
void stop(){
@@ -117,6 +130,7 @@ public:
int numDevices;
ofxOpenNI openNIPlayers[MAX_DEVICES];
+ ofxOpenNIUser user;
int playing;
@@ -130,6 +144,7 @@ public:
ofxOscReceiver receiver;
+ bool drawmovies,drawcloud;
int offset;
};