void Ruleta::draw(){ for (std::vector<priceIcon>::iterator it = ruleta.begin() ; it != ruleta.end(); ++it){ drawPriceIcon(*it); if (time > 0) (*it).x += speed; } drawMasks(); ofSetColor(255); update(); }
//-------------------------------------------------------------- void testApp::draw(){ ofSetColor(255, 255, 255); glPushMatrix(); glScalef(0.50, 0.50, 0.50); recordDepth.draw(0,0,640,480); recordUser.draw(); drawMasks(); glPopMatrix(); ofSetColor(255, 255, 0); string statusHardware; #ifdef TARGET_OSX // only working on Mac at the moment ofPoint statusAccelerometers = hardware.getAccelerometers(); stringstream statusHardwareStream; statusHardwareStream << "ACCELEROMETERS:" << " TILT: " << hardware.getTiltAngle() << "/" << hardware.tilt_angle << " x - " << statusAccelerometers.x << " y - " << statusAccelerometers.y << " z - " << statusAccelerometers.z; statusHardware = statusHardwareStream.str(); #endif stringstream msg; msg << "FPS : " << ofToString(ofGetFrameRate()) << " " << statusHardware << endl; ofDrawBitmapString(msg.str(), 20, 500); }
//-------------------------------------------------------------- void testApp::draw(){ ofBackground(red, blue, green); ofEnableAlphaBlending(); ofSetColor(255, 255, 255, 25); drawGrid(8,8); ofDisableAlphaBlending(); ofSetColor(255, 255, 255); ofPushMatrix(); ofTranslate(255, 0); glPushMatrix(); glScalef(0.75, 0.75, 0.75); if (isLive) { recordDepth.draw(0,0,640,480); recordImage.draw(640, 0, 640, 480); depthRangeMask.draw(0, 480, 320, 240); // can use this with openCV to make masks, find contours etc when not dealing with openNI 'User' like objects if (isTracking) { recordUser.draw(); if (isMasking) drawMasks(); if (isCloud) drawPointCloud(&recordUser, 1); // 0 gives you all point clouds; use userID to see point clouds for specific users } if (isTrackingHands) recordHandTracker.drawHands(); } else { playDepth.draw(0,0,640,480); playImage.draw(640, 0, 640, 480); depthRangeMask.draw(0, 480, 320, 240); // can use this with openCV to make masks, find contours etc when not dealing with openNI 'User' like objects if (isTracking) { playUser.draw(); if (isMasking) drawMasks(); if (isCloud) drawPointCloud(&playUser, 0); // 0 gives you all point clouds; use userID to see point clouds for specific users } if (isTrackingHands) playHandTracker.drawHands(); } glPopMatrix(); ofSetColor(255, 255, 0); string statusPlay = (string)(isLive ? "LIVE STREAM" : "PLAY STREAM"); string statusRec = (string)(!isRecording ? "READY" : "RECORDING"); string statusSkeleton = (string)(isTracking ? "TRACKING USERS: " + (string)(isLive ? ofToString(recordUser.getNumberOfTrackedUsers()) : ofToString(playUser.getNumberOfTrackedUsers())) + "" : "NOT TRACKING USERS"); string statusSmoothSkel = (string)(isLive ? ofToString(recordUser.getSmoothing()) : ofToString(playUser.getSmoothing())); string statusHands = (string)(isTrackingHands ? "TRACKING HANDS: " + (string)(isLive ? ofToString(recordHandTracker.getNumTrackedHands()) : ofToString(playHandTracker.getNumTrackedHands())) + "" : "NOT TRACKING"); string statusFilter = (string)(isFiltering ? "FILTERING" : "NOT FILTERING"); string statusFilterLvl = ofToString(filterFactor); string statusSmoothHand = (string)(isLive ? ofToString(recordHandTracker.getSmoothing()) : ofToString(playHandTracker.getSmoothing())); string statusMask = (string)(!isMasking ? "HIDE" : (isTracking ? "SHOW" : "YOU NEED TO TURN ON TRACKING!!")); string statusCloud = (string)(isCloud ? "ON" : "OFF"); string statusCloudData = (string)(isCPBkgnd ? "SHOW BACKGROUND" : (isTracking ? "SHOW USER" : "YOU NEED TO TURN ON TRACKING!!")); string statusHardware; #ifdef TARGET_OSX // only working on Mac at the moment ofPoint statusAccelerometers = hardware.getAccelerometers(); stringstream statusHardwareStream; statusHardwareStream << "ACCELEROMETERS:" << " TILT: " << hardware.getTiltAngle() << "/" << hardware.tilt_angle << " x - " << statusAccelerometers.x << " y - " << statusAccelerometers.y << " z - " << statusAccelerometers.z; statusHardware = statusHardwareStream.str(); #endif stringstream msg; msg << " s : start/stop recording : " << statusRec << endl << " p : playback/live streams : " << statusPlay << endl << " t : skeleton tracking : " << statusSkeleton << endl << "( / ) : smooth skely (openni) : " << statusSmoothSkel << endl << " h : hand tracking : " << statusHands << endl << " f : filter hands (custom) : " << statusFilter << endl << "[ / ] : filter hands factor : " << statusFilterLvl << endl << "; / ' : smooth hands (openni) : " << statusSmoothHand << endl << " m : drawing masks : " << statusMask << endl << " c : draw cloud points : " << statusCloud << endl << " b : cloud user data : " << statusCloudData << endl << "- / + : nearThreshold : " << ofToString(nearThreshold) << endl << "< / > : farThreshold : " << ofToString(farThreshold) << endl << endl << "File : " << oniRecorder.getCurrentFileName() << endl << "FPS : " << ofToString(ofGetFrameRate()) << " " << statusHardware << endl; ofDrawBitmapString(msg.str(), 20, 560); ofPopMatrix(); }
//-------------------------------------------------------------- void testApp::draw(){ ofSetColor(255, 255, 255); glPushMatrix(); if (isLive) { recordImage.draw(0, 0, 640 * 1.6, 480 * 1.6); if (isTracking) { ofScale(1.6, 1.6); recordUser.draw(); } } else { if (isTracking) { playUser.draw(); if (isMasking) drawMasks(); if (isCloud) drawPointCloud(&playUser, 0); // 0 gives you all point clouds; use userID to see point clouds for specific users } if (isTrackingHands) playHandTracker.drawHands(); } glPopMatrix(); ofSetColor(0); ofFill(); if (recordUser.getNumberOfTrackedUsers() > 0) { ofPushMatrix(); //ofScale(1.6, 1.6); for (int i = 0; i < 4; i++) { parts[i].draw(); } ofPopMatrix(); } // ofLine(centerPoint, rootPoint); // ofLine(centerPoint, otherLegPoint); // // ofLine(centerPoint, leftShoulderPoint); // ofLine(centerPoint, rightShoulderPoint); // draw root circle if (partIsOverRootLeg) ofSetColor(0, 255, 0); if (!partIsOverRootLeg) ofSetColor(0, 0, 255); ofCircle(rootPoint, 30); // draw other leg circle if (partIsOverOtherLeg) ofSetColor(0, 255, 0); if (!partIsOverOtherLeg) ofSetColor(0, 0, 255); ofCircle(otherLegPoint, 30); // // draw smaller shoulder circles // ofCircle(leftShoulderPoint, 10); // ofCircle(rightShoulderPoint, 10); // draw hands if (partIsOverLeftHand) ofSetColor(0, 255, 0); if (!partIsOverLeftHand) ofSetColor(0, 0, 255); ofCircle(leftHandPoint, 30); if (partIsOverRightHand) ofSetColor(0, 255, 0); if (!partIsOverRightHand) ofSetColor(0, 0, 255); ofCircle(rightHandPoint, 30); // draw group name so we know what we're looking at string currentGroup; if (currentIndex == 0) currentGroup = "LOW-ED-NATIVE"; if (currentIndex == 1) currentGroup = "HIGH-ED-NATIVE"; if (currentIndex == 2) currentGroup = "LOW-ED-IMMIGRANT"; if (currentIndex == 3) currentGroup = "HIGH-ED-IMMIGRANT"; ofDrawBitmapString(currentGroup, 20, 20); ofDrawBitmapString(ofToString(unemploymentRates[currentIndex]/amplifier) + "%", 20, 40); // ofSetColor(255, 255, 0); // // string statusPlay = (string)(isLive ? "LIVE STREAM" : "PLAY STREAM"); // string statusRec = (string)(!isRecording ? "READY" : "RECORDING"); // string statusSkeleton = (string)(isTracking ? "TRACKING USERS: " + (string)(isLive ? ofToString(recordUser.getNumberOfTrackedUsers()) : ofToString(playUser.getNumberOfTrackedUsers())) + "" : "NOT TRACKING USERS"); // string statusSmoothSkel = (string)(isLive ? ofToString(recordUser.getSmoothing()) : ofToString(playUser.getSmoothing())); // string statusHands = (string)(isTrackingHands ? "TRACKING HANDS: " + (string)(isLive ? ofToString(recordHandTracker.getNumTrackedHands()) : ofToString(playHandTracker.getNumTrackedHands())) + "" : "NOT TRACKING"); // string statusFilter = (string)(isFiltering ? "FILTERING" : "NOT FILTERING"); // string statusFilterLvl = ofToString(filterFactor); // string statusSmoothHand = (string)(isLive ? ofToString(recordHandTracker.getSmoothing()) : ofToString(playHandTracker.getSmoothing())); // string statusMask = (string)(!isMasking ? "HIDE" : (isTracking ? "SHOW" : "YOU NEED TO TURN ON TRACKING!!")); // string statusCloud = (string)(isCloud ? "ON" : "OFF"); // string statusCloudData = (string)(isCPBkgnd ? "SHOW BACKGROUND" : (isTracking ? "SHOW USER" : "YOU NEED TO TURN ON TRACKING!!")); // // string statusHardware; // //#ifdef TARGET_OSX // only working on Mac at the moment // ofPoint statusAccelerometers = hardware.getAccelerometers(); // stringstream statusHardwareStream; // // statusHardwareStream // << "ACCELEROMETERS:" // << " TILT: " << hardware.getTiltAngle() << "/" << hardware.tilt_angle // << " x - " << statusAccelerometers.x // << " y - " << statusAccelerometers.y // << " z - " << statusAccelerometers.z; // // statusHardware = statusHardwareStream.str(); //#endif // // stringstream msg; // // msg // << " s : start/stop recording : " << statusRec << endl // << " p : playback/live streams : " << statusPlay << endl // << " t : skeleton tracking : " << statusSkeleton << endl // << "( / ) : smooth skely (openni) : " << statusSmoothSkel << endl // << " h : hand tracking : " << statusHands << endl // << " f : filter hands (custom) : " << statusFilter << endl // << "[ / ] : filter hands factor : " << statusFilterLvl << endl // << "; / ' : smooth hands (openni) : " << statusSmoothHand << endl // << " m : drawing masks : " << statusMask << endl // << " c : draw cloud points : " << statusCloud << endl // << " b : cloud user data : " << statusCloudData << endl // << "- / + : nearThreshold : " << ofToString(nearThreshold) << endl // << "< / > : farThreshold : " << ofToString(farThreshold) << endl // << endl // << "File : " << oniRecorder.getCurrentFileName() << endl // << "FPS : " << ofToString(ofGetFrameRate()) << " " << statusHardware << endl; // // ofDrawBitmapString(msg.str(), 20, 560); }
//-------------------------------------------------------------- void testApp::draw(){ ofSetColor(255, 255, 255); glPushMatrix(); glScalef(0.75, 0.75, 0.75); if (isLive) { recordDepth.draw(0,0,640,480); recordImage.draw(640, 0, 640, 480); depthRangeMask.draw(0, 480, 320, 240); // can use this with openCV to make masks, find contours etc when not dealing with openNI 'User' like objects opFlow.draw(640,480); if (isTracking) { recordUser.draw(); if (isMasking) drawMasks(); if (isCloud) drawPointCloud(&recordUser, 1); // 0 gives you all point clouds; use userID to see point clouds for specific users if(!isPlaying){ midiOut.sendControlChange(synthChan, 92, 127); midiOut.sendControlChange(effectsChan, 92, 127); //midiOut.sendControlChange(synthChan, 90, 127); isPlaying = true; } for(int i = 1; i == recordUser.getNumberOfTrackedUsers(); i++) { ofxTrackedUser* currentUser = recordUser.getTrackedUser(i); if(currentUser != NULL){ if(currentUser->skeletonTracking) xPadSynth = ofMap(currentUser->left_lower_arm.position[1].X, 0, ofGetWidth()/1.5, 0, 127); yPadSynth = ofMap(currentUser->left_lower_arm.position[1].Y, 0, ofGetHeight()/1.5, 127, 0); xPadEffects = ofMap(currentUser->right_lower_arm.position[1].X, 0, ofGetWidth()/1.5, 0, 127); yPadEffects = ofMap(currentUser->right_lower_arm.position[1].Y, 0, ofGetWidth()/1.5, 127, 0); midiOut.sendControlChange(synthChan, 12, xPadSynth); midiOut.sendControlChange(synthChan, 13, yPadSynth); midiOut.sendControlChange(effectsChan, 12, xPadEffects); midiOut.sendControlChange(effectsChan, 13, yPadEffects); } /*ofxLimb leftArm = recordUser.getTrackedUser(i)->left_lower_arm; xPadSynth = ofMap(rightArm.position[1].X, 0, ofGetWidth()/1.5, 0, 127); yPadSynth = ofMap(rightArm.position[1].Y, 0, ofGetHeight()/1.5, 127, 0); xPadEffects = ofMap(leftArm.position[1].X, 0, ofGetWidth()/1.5, 0, 127); yPadEffects = ofMap(leftArm.position[1].Y, 0, ofGetWidth()/1.5, 0, 127); midiOut.sendControlChange(synthChan, 12, xPadSynth); midiOut.sendControlChange(synthChan, 13, yPadSynth); midiOut.sendControlChange(effectsChan, 12, xPadEffects); midiOut.sendControlChange(effectsChan, 13, yPadEffects);*/ } } else { if(isPlaying){ midiOut.sendControlChange(synthChan, 92, 0); midiOut.sendControlChange(effectsChan, 92, 0); //midiOut.sendControlChange(synthChan, 90, 0); isPlaying = false; } } if (isTrackingHands) { recordHandTracker.drawHands(); } } else { playDepth.draw(0,0,640,480); playImage.draw(640, 0, 640, 480); depthRangeMask.draw(0, 480, 320, 240); // can use this with openCV to make masks, find contours etc when not dealing with openNI 'User' like objects if (isTracking) { playUser.draw(); if (isMasking) drawMasks(); if (isCloud) drawPointCloud(&playUser, 0); // 0 gives you all point clouds; use userID to see point clouds for specific users } if (isTrackingHands) playHandTracker.drawHands(); } glPopMatrix(); ofSetColor(255, 255, 0); string statusPlay = (string)(isLive ? "LIVE STREAM" : "PLAY STREAM"); string statusRec = (string)(!isRecording ? "READY" : "RECORDING"); string statusSkeleton = (string)(isTracking ? "TRACKING USERS: " + (string)(isLive ? ofToString(recordUser.getNumberOfTrackedUsers()) : ofToString(playUser.getNumberOfTrackedUsers())) + "" : "NOT TRACKING USERS"); string statusSmoothSkel = (string)(isLive ? ofToString(recordUser.getSmoothing()) : ofToString(playUser.getSmoothing())); string statusHands = (string)(isTrackingHands ? "TRACKING HANDS: " + (string)(isLive ? ofToString(recordHandTracker.getNumTrackedHands()) : ofToString(playHandTracker.getNumTrackedHands())) + "" : "NOT TRACKING"); string statusFilter = (string)(isFiltering ? "FILTERING" : "NOT FILTERING"); string statusFilterLvl = ofToString(filterFactor); string statusSmoothHand = (string)(isLive ? ofToString(recordHandTracker.getSmoothing()) : ofToString(playHandTracker.getSmoothing())); string statusMask = (string)(!isMasking ? "HIDE" : (isTracking ? "SHOW" : "YOU NEED TO TURN ON TRACKING!!")); string statusCloud = (string)(isCloud ? "ON" : "OFF"); string statusCloudData = (string)(isCPBkgnd ? "SHOW BACKGROUND" : (isTracking ? "SHOW USER" : "YOU NEED TO TURN ON TRACKING!!")); string statusHardware; #ifdef TARGET_OSX // only working on Mac at the moment ofPoint statusAccelerometers = hardware.getAccelerometers(); stringstream statusHardwareStream; statusHardwareStream << "ACCELEROMETERS:" << " TILT: " << hardware.getTiltAngle() << "/" << hardware.tilt_angle << " x - " << statusAccelerometers.x << " y - " << statusAccelerometers.y << " z - " << statusAccelerometers.z; statusHardware = statusHardwareStream.str(); #endif stringstream msg; msg << " s : start/stop recording : " << statusRec << endl << " p : playback/live streams : " << statusPlay << endl << " t : skeleton tracking : " << statusSkeleton << endl << "( / ) : smooth skely (openni) : " << statusSmoothSkel << endl << " h : hand tracking : " << statusHands << endl << " f : filter hands (custom) : " << statusFilter << endl << "[ / ] : filter hands factor : " << statusFilterLvl << endl << "; / ' : smooth hands (openni) : " << statusSmoothHand << endl << " m : drawing masks : " << statusMask << endl << " c : draw cloud points : " << statusCloud << endl << " b : cloud user data : " << statusCloudData << endl << "- / + : nearThreshold : " << ofToString(nearThreshold) << endl << "< / > : farThreshold : " << ofToString(farThreshold) << endl << endl << "File : " << oniRecorder.getCurrentFileName() << endl << "FPS : " << ofToString(ofGetFrameRate()) << " " << statusHardware << endl; ofDrawBitmapString(msg.str(), 20, 560); stringstream midiText; midiText << "connected to port " << midiOut.getPort() << " \"" << midiOut.getName() << "\"" << endl << "is virtual?: " << midiOut.isVirtual() << endl << endl << "sending to channel " << channel << endl << endl << "current program: " << currentPgm << endl << endl << "note: " << note << endl << "velocity: " << velocity << endl << "Xsynth: " << xPadSynth << endl << "Ysynth: " << yPadSynth << endl << "Xeffects: " << xPadSynth << endl << "Yeffects: " << yPadSynth << endl << "touch: " << touch << endl << "polytouch: " << polytouch; ofDrawBitmapString(midiText.str(), 700, 560); }
//-------------------------------------------------------------- void kinectController::draw(){ glPushMatrix(); if (isTracking) { //recordUser.draw(); if(showFullBodyTracker) drawMasks(); } stringstream msg; if(showFullBodyTracker) { int i = recordUser.getNumberOfTrackedUsers(); if(i > 0) { ofxTrackedUser * tracked = recordUser.getTrackedUser(i); if(tracked != NULL) { if(tracked->neck.found) { msg << "tracking neck " << (int)tracked->neck.position[1].X << "," << (int)tracked->neck.position[1].Y << "," << (int)tracked->neck.position[1].Z << endl; position = tracked->neck.position[1]; tracking = true; } } else tracking = false; } else { msg << "not tracking" << endl; tracking = false; } ofSetColor(255, 255, 255); myFont.drawString(msg.str(), 30, 50); } if(showHands) { if(recordHandTracker.getNumTrackedHands() > 0) { for(int i = 0; i < recordHandTracker.getNumTrackedHands(); i++) { ofxTrackedHand* tHand = recordHandTracker.getHand(i); if(tHand != NULL) { ofPoint pos = tHand->progPos; ofFill(); ofCircle(pos.x * ofGetWidth(), pos.y * ofGetHeight(), 15); } } } } glPopMatrix(); }