//-------------------------------------------------------------- void testApp::update(){ ofBackground(50,50,50); // camera or movie #ifdef LIVE_VIDEO spermMovie.grabFrame(); #else spermMovie.idleMovie(); #endif // contour detection if (spermMovie.isFrameNew()){ prevFrame=currFrame; currFrameColor.setFromPixels(spermMovie.getPixels(),MOVIE_WIDTH,MOVIE_HEIGHT); currFrame.setFromColorImage(currFrameColor); grayDiff.Sub(prevFrame, currFrame); grayDiff.threshold(threshold); // contour detection: (image,min area,max area,max number of contours, hole detection) contourFinder.findContours(grayDiff,minArea,maxArea,50,false); } // reception of data from wiimote (OSC) receiveOSC(); }
//-------------------------------------------------------------- void gamuzaMain::update(){ char temp_message[512]; ////////////////////////////////////////////// // INIT PROGRAM | splash image control if(ofGetElapsedTimeMillis() > splashWait){ splashFinish = true; if(flagSystemLoaded){ flagSystemLoaded = false; sprintf(temp_message,"OpenGL version: %s", glGetString (GL_VERSION)); sendPrivateMessage(GAMUZA_CONSOLE_LOG, temp_message); sendPrivateMessage(GAMUZA_CONSOLE_LOG, " "); if(GL_ARB_shader_objects){ sprintf(temp_message,"GL_ARB_shader SUPPORTED by your Graphic Card: %s", glGetString (GL_RENDERER)); sendPrivateMessage(GAMUZA_CONSOLE_LOG, temp_message); sendPrivateMessage(GAMUZA_CONSOLE_LOG, " "); }else{ sprintf(temp_message,"GL_ARB_shader NOT SUPPORTED by your Graphic Card: %s", glGetString (GL_RENDERER)); sendPrivateMessage(GAMUZA_CONSOLE_LOG, temp_message); sendPrivateMessage(GAMUZA_CONSOLE_LOG, "switching to SHADER OFF MODE"); sendPrivateMessage(GAMUZA_CONSOLE_LOG, " "); } if(audioActivated){ soundStream.start(); sendPrivateMessage(GAMUZA_CONSOLE_LOG, "soundStream STARTED"); sendPrivateMessage(GAMUZA_CONSOLE_LOG, " "); for(unsigned int i = 0; i < audioInputChannels; i++){ inputAudioCH[i].computeChannel = true; } computeAudioInput = true; computeAudioOutput = true; } if(arduinoActivated){ sendPrivateMessage(GAMUZA_CONSOLE_LOG, "ARDUINO connection established"); sendPrivateMessage(GAMUZA_CONSOLE_LOG, " "); } } ////////////////////////////////////////////// // Main settings control ofSetVerticalSync(useVSync); ////////////////////////////////////////////// ////////////////////////////////////////////// // GUI update updateGui(); gui.update(); ////////////////////////////////////////////// ////////////////////////////////////////////// // FBO Output Texture update updateFBO(); ////////////////////////////////////////////// ////////////////////////////////////////////// // OPENNI if(openniActivated && sensorKinect.useKinect && sensorKinect.isOniConnected){ sensorKinect.updateDevice(); } ////////////////////////////////////////////// ////////////////////////////////////////////// // WEBCAM input devices update if(trackingActivated){ for(unsigned int i=0;i<numCamInputs;i++){ if(inputCam[i].captureVideo){ inputCam[i].update(); } } } ////////////////////////////////////////////// ////////////////////////////////////////////// // ARDUINO update if(arduinoActivated && useArduino){ updateArduino(); } ////////////////////////////////////////////// } ////////////////////////////////////////////// ////////////////////////////////////////////// // OSC update updateOSC(); // OSC messages receiving receiveOSC(); ////////////////////////////////////////////// ////////////////////////////////////////////// // SYSTEM gamuzaRealFPS = ofGetFrameRate(); gaFrameCounter++; ////////////////////////////////////////////// }