//-------------------------------------------------------------- void ofxMtlMapping2D::draw() { if(ofxMtlMapping2DControls::mapping2DControls()->editShapes()) { // ---- OUTPUT MODE if(ofxMtlMapping2DControls::mapping2DControls()->mappingMode() == MAPPING_MODE_OUTPUT) { render(); // ---- INPUT MODE } else if (ofxMtlMapping2DControls::mapping2DControls()->mappingMode() == MAPPING_MODE_INPUT) { // ---- drawFbo(); } // ---- list<ofxMtlMapping2DShape*>::iterator it; for (it=ofxMtlMapping2DShapes::pmShapes.begin(); it!=ofxMtlMapping2DShapes::pmShapes.end(); it++) { ofxMtlMapping2DShape* shape = *it; if(shape != ofxMtlMapping2DShape::activeShape) { shape->draw(); } } if(ofxMtlMapping2DShape::activeShape) { //Draw active shape on top ofxMtlMapping2DShape::activeShape->draw(); } } else { render(); } }
//-------------------------------------------------------------- void testApp::update(){ //Dessin des fbo fbo1.begin(); drawFbo(); fbo1.end(); fbo2.begin(); drawFbo(); fbo2.end(); Mainfbo.begin(); drawFbo(); Mainfbo.end(); }
// PANEL VIEW GUI //-------------------------------------------------------------- void ofApp::drawPanels() { // /* ofPushMatrix(); ofTranslate(319, 520, 0); ofScale(5, 5); ofRotate(90); ofRotateZ(180); ofRotateX(180); drawFbo(); ofPopMatrix(); ofPushMatrix(); ofTranslate(638, 520, 0); ofScale(5, 5); ofRotate(90); ofRotateZ(180); ofRotateX(180); drawFbo(); ofPopMatrix(); // */ ofColor colors; ofPushMatrix(); ofTranslate(1, 190, 0); ofRotate(90); ofRotateZ(180); ofSetRectMode(OF_RECTMODE_CENTER); for (int y = 0; y < stripHeight*stripsPerPort*numPorts; y++) { for (int x = 0; x < stripWidth; x++) { ofPushMatrix(); colors = guiPixels.getColor(x, y);//teensy.pixels1.getColor(x, y); ofSetColor(colors); ofTranslate(x*2, y*2 + (y/16*4)); //sections in groups ofRect(x, y, 2, 2); ofPopMatrix(); } } ofSetRectMode(OF_RECTMODE_CORNER); ofPopMatrix(); }
// ONLY GUI DRAWS GO HERE //-------------------------------------------------------------- void ofApp::draw() { // draw our graphics on-screen so we can copy to texture. ofPushMatrix(); ofTranslate(699, 480); drawFbo(); ofPopMatrix(); drawPanels(); // brightness draw ofSetColor(255, 255, 255); ofDrawBitmapString("// PROJECT LUMI //", ofGetWidth()-250, 20); ofDrawBitmapString("Rotate (r) == " + ofToString(fboRotate), ofGetWidth()-250, 40); ofDrawBitmapString("Flip (f) == " + ofToString(fboFlip), ofGetWidth()-250, 60); ofDrawBitmapString("Bright (u/d) == " + ofToString(brightness), ofGetWidth()-250, 80); ofDrawBitmapString("Speed (l/r) == " + ofToString(waveSpeed), ofGetWidth()-250, 100); ofDrawBitmapString("Videos # == " + ofToString(dirVid.size()), ofGetWidth()-250, 120); ofDrawBitmapString("Images # == " + ofToString(dirImg.size()), ofGetWidth()-250, 140); ofDrawBitmapString("GIFs # == " + ofToString(dirGif.size()), ofGetWidth()-250, 160); }
//-------------------------------------------------------------- void testApp::draw(){ glEnable (GL_DEPTH_TEST); glClearColor(0.0, 0.0, 0.0, 1.0); glClearDepth(1.0); glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_TEXTURE_2D); glPushMatrix(); bindFbo(); //glDisable(GL_DEPTH_TEST); //kinectImage.draw(0, 0); //glEnable (GL_DEPTH_TEST); //if(bDraw){ //bindFbo(); glMatrixMode( GL_PROJECTION ); glPushMatrix(); glLoadMatrixf(tracker->getProjectionMatrix()); glMatrixMode( GL_MODELVIEW ); glPushMatrix(); glLoadMatrixf(tracker->getModelViewMatrix()); doLights(); glTranslatef(offset.x,offset.y,0); glRotatef(90, 1, 0, 0); glScalef(mapScale, mapScale, mapScale); //x glBegin(GL_LINES); glColor3f(1, 0, 0); glVertex3f(0,0,0); glVertex3f(300,0,0); glEnd(); //y glBegin(GL_LINES); glColor3f(0, 1, 0); glVertex3f(0,0,0); glVertex3f(0,300,0); glEnd(); //z glBegin(GL_LINES); glColor3f(0, 0, 1); glVertex3f(0,0,0); glVertex3f(0,0,300); glEnd(); glColor3f(1,1,1); for(int x=0; x < mapWidth; x++){ for(int y=0; y < mapHeight; y++){ for(int z=0; z < mapDepth; z++){ Block* b = &array3D[x][y][z]; if(b->type != NONE && b->visMask != 0){ drawBlock(x * 10,y * 10,z * 10, 10, 10,10, b); } } } } //get our depth buffer data //glReadPixels(0, 0, 640, 480, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, sceneDepthBuf); //glReadPixels(0, 0, 640, 480, GL_RGB, GL_UNSIGNED_BYTE, sceneBuffer); glMatrixMode( GL_PROJECTION ); glPopMatrix(); glMatrixMode( GL_MODELVIEW ); glPopMatrix(); //unbindFbo(); //draw the player //} unbindFbo(); glPopMatrix(); glDisable(GL_LIGHTING); glDisable (GL_DEPTH_TEST); ofEnableAlphaBlending(); kinectImage.draw(0, 0); if(!bDraw){ //ofSetColor(sceneWhiteLevel); int v = ofMap(ofGetElapsedTimeMillis() - lastDetectTime, 0, 100, 0, 255, true); ofSetColor(255, 255, 255, 255 - (int)v); } drawFbo(); //ofSetColor(255,255,255); if(guiDraw){ kinectDepthImage.draw(0,0,160,120); sceneDepthImage.draw(0,120,160,120); finalMaskImage.draw(0,240, 160,120); ofDrawBitmapString(ofToString(scVal), 300,20); } #ifdef KINECT int ct = 0; for(int p = 0; p < 640 * 480 ; p++){ unsigned short kinectVal = kinectDepthBuf[p]; unsigned short sceneVal = USHRT_MAX - sceneDepthBuf[p]; if(kinectVal > sceneVal){ finalBuf[p] = 255; } else { finalBuf[p] = 0; } } //finalImage.setFromPixels(finalImageBuf, 640, 480); //glColor3f(1, 1, 1); finalMaskImage.setFromPixels(finalBuf, 640, 480); #endif #ifdef SYPHON mainOutputSyphonServer.publishFail(&thisWillNeverWork); #endif }