Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/ofxOpenNI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@
//--------------------------------------------------------------
ofxOpenNI::ofxOpenNI(){
instanceCount++;
instanceID = instanceCount; // TODO: this should be replaced/combined with a listDevices and setDeviceID methods

// by default we use multiple kinects in the order they're available
// but you can also use setDeviceID to manually pick the deviceID
// if you try to run user generators with more than one device in the same
// process you'll be warned.
instanceID = instanceCount;

LOG_NAME = "ofxOpenNIDevice[" + ofToString(instanceID) + "]";
//cout << LOG_NAME << ": constructor called" << endl;

Expand Down Expand Up @@ -753,7 +757,7 @@ bool ofxOpenNI::addInfraGenerator(){
//--------------------------------------------------------------
bool ofxOpenNI::addUserGenerator(){
ofxOpenNIScopedLock scopedLock(bIsThreaded, mutex);
if(instanceID > 0) {
if(instanceCount > 0) {
// see: http://groups.google.com/group/openni-dev/browse_thread/thread/188a2ac823584117
ofLogWarning(LOG_NAME) << "Currently it is only possible to have a user generator on one device in a single process!!";
g_bIsUserOn = false;
Expand Down Expand Up @@ -2768,6 +2772,11 @@ int ofxOpenNI::getNumDevices(){
return numDevices;
}

//--------------------------------------------------------------
void ofxOpenNI::setDeviceID(int deviceID){
instanceID = deviceID;
}

//--------------------------------------------------------------
int ofxOpenNI::getDeviceID(){
return instanceID;
Expand Down
2 changes: 2 additions & 0 deletions src/ofxOpenNI.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ class ofxOpenNI : public ofThread {
ofPoint cameraToWorld(const ofVec2f& c);
void cameraToWorld(const vector<ofVec2f>& c, vector<ofVec3f>& w);


void setDeviceID(int deviceID);
int getDeviceID();

xn::Context& getContext();
Expand Down