Esempio n. 1
0
//-------------------------------
void ofxControlPanel::draw(){
    if( hidden ) return;

	lastFrameDrawn	= ofGetFrameNum();

    ofPushStyle();
    ofEnableAlphaBlending();

        float panelH = boundingBox.height;
        if( minimize ){
            panelH = topBar.height;
        }

		if(!bInvisible || !elementSelected){

			glPushMatrix();
				glTranslatef(boundingBox.x, boundingBox.y, 0);
				//draw the background
				ofFill();
				glColor4fv(bgColor.getColorF());
				ofRect(0, 0, boundingBox.width, panelH);

				//draw the outline
				ofNoFill();
				glColor4fv(outlineColor.getColorF());
				ofRect(0, 0, boundingBox.width, panelH);
				ofLine(0, topBar.height, boundingBox.width, topBar.height);
			glPopMatrix();

			ofRect(minimizeButton.x, minimizeButton.y, minimizeButton.width, minimizeButton.height);

			if ( bDoSaveRestore ){
				ofPushStyle();
					ofFill();

					if( saveDown )glColor4fv(fgColor.getSelectedColorF());
					else glColor4fv(fgColor.getColorF());

					ofRect(saveButton.x, saveButton.y, saveButton.width,saveButton.height);
					ofSetColor(255, 255, 255);
				
					displayText.renderString("save", saveButton.x + 3, saveButton.y + saveButton.height -3);

				ofPopStyle();

				ofPushStyle();
					ofFill();

					if( restoreDown )glColor4fv(fgColor.getSelectedColorF());
					else glColor4fv(fgColor.getColorF());

					ofRect(restoreButton.x, restoreButton.y, restoreButton.width,restoreButton.height);
					ofSetColor(255, 255, 255);
				
					displayText.renderString("restore", restoreButton.x + 3, restoreButton.y + restoreButton.height -3);
				
				ofPopStyle();
			}


			ofPushMatrix();
				ofTranslate(2,0,0);
				glColor4fv(textColor.getColorF());
				guiBaseObject::renderText();
			ofPopMatrix();
		
		}

        if( !minimize ){

            //don't let gui elements go out of their panels
            glEnable(GL_SCISSOR_TEST);
            glScissor(boundingBox.x, ofGetHeight() - ( boundingBox.y + boundingBox.height - (-2 + topSpacing) ), boundingBox.width - borderWidth , boundingBox.height);

				if(!bInvisible || !elementSelected){
					for(int i = 0; i < (int) panelTabs.size(); i++){
						if( i == selectedPanel){
							ofPushStyle();
								ofFill();
								glColor4fv(fgColor.getSelectedColorF());
								ofRect(panelTabs[i].x, panelTabs[i].y, panelTabs[i].width, panelTabs[i].height);
								glColor4fv(outlineColor.getColorF());
							ofPopStyle();
						}
						glColor4fv(outlineColor.getColorF());
						ofNoFill();
						ofRect(panelTabs[i].x, panelTabs[i].y, panelTabs[i].width, panelTabs[i].height);
					}
				}

                glPushMatrix();
                    glTranslatef(hitArea.x, hitArea.y, 0);
                    for(int i = 0; i < (int) panels.size(); i++){
                        if( i == selectedPanel ){
							panels[i]->setShowOnlySelectedElement(bInvisible);
							panels[i]->render();
						}
					}
                glPopMatrix();

            glDisable(GL_SCISSOR_TEST);
        }

    ofPopStyle();
	
	if(bShowStatusBar){
		ofPushStyle();
		
			float textH = displayText.getTextSingleLineHeight() + 4;
			
			float yPos = ofGetHeight()-textH;
		
			glColor4fv(bgColor.getColorF());
			ofRect(0, yPos, ofGetWidth(), textH);
			
			glColor4fv(textColor.getColorF());
			displayText.renderString("Fps: " + ofToString(ofGetFrameRate(), 0) + "  Status: " + statusMessage, 4, yPos + textH - 4);
			
		ofPopStyle();
	}
}
Esempio n. 2
0
//---------------------------------------------------------------------------
void ofxTSPSPeopleTracker::drawBlobs( float drawWidth, float drawHeight){
	
	float scaleVar = (float) drawWidth/width;
	
	ofFill();
	ofSetHexColor(0x333333);
	ofRect(0,0,drawWidth,drawHeight);
	ofSetHexColor(0xffffff);
	
	ofNoFill();
	
	if (p_Settings->bTrackOpticalFlow){
		ofSetColor(34,151,210);
		opticalFlow.draw(drawWidth,drawHeight);
	}					
	
	ofPushMatrix();
	ofScale(scaleVar, scaleVar);
	
	// simpler way to draw contours: contourFinder.draw();
	
	for (int i=0; i < trackedPeople.size(); i++){
		
		//draw blobs				
		//if haarfinder is looking at these blobs, draw the area it's looking at
		ofxTSPSPerson* p = trackedPeople[i];
		
		//draw contours 
		ofPushStyle();
		ofNoFill();
		if (p_Settings->bSendOscContours){
			ofSetHexColor(0x3abb93);
		} else {
			ofSetHexColor(0xc4b68e);
		}
		ofBeginShape();
		for( int j=0; j<p->contour.size(); j++ ) {
			ofVertex( p->contour[j].x, p->contour[j].y );
		}
		ofEndShape();
		ofPopStyle();
		
		if(p_Settings->bTrackOpticalFlow){
			//purple optical flow arrow
			ofSetHexColor(0xff00ff);
			//JG Doesn't really provide any helpful information since its so scattered
//			ofLine(p->centroid.x, 
//				   p->centroid.y, 
//				   p->centroid.x + p->opticalFlowVectorAccumulation.x, 
//				   p->centroid.y + p->opticalFlowVectorAccumulation.y);
		}
		
		ofSetHexColor(0xffffff);							
		if(p_Settings->bDetectHaar){
			ofSetHexColor(0xee3523);
			//draw haar search area expanded 
			//limit to within data box so it's not confusing
			/*ofRect(p->boundingRect.x - p_Settings->haarAreaPadding, 
				   p->boundingRect.y - p_Settings->haarAreaPadding, 
				   p->boundingRect.width  + p_Settings->haarAreaPadding*2, 
				   p->boundingRect.height + p_Settings->haarAreaPadding*2);*/
				
				ofRectangle haarRect = ofRectangle(p->boundingRect.x - p_Settings->haarAreaPadding, 
												   p->boundingRect.y - p_Settings->haarAreaPadding, 
												   p->boundingRect.width  + p_Settings->haarAreaPadding*2, 
												   p->boundingRect.height + p_Settings->haarAreaPadding*2);
				if (haarRect.x < 0){
					haarRect.width += haarRect.x;
					haarRect.x = 0;					
				}
				if (haarRect.y < 0){
					haarRect.height += haarRect.y;	
					haarRect.y = 0;
				}
				if (haarRect.x + haarRect.width > width) haarRect.width = width-haarRect.x;
				if (haarRect.y + haarRect.height > height) haarRect.height = height-haarRect.y;
				ofRect(haarRect.x, haarRect.y, haarRect.width, haarRect.height);
		}
		
		if(p->hasHaarRect()){
			//draw the haar rect
			ofSetHexColor(0xee3523);
			ofRect(p->getHaarRect().x, p->getHaarRect().y, p->getHaarRect().width, p->getHaarRect().height);
			//haar-detected people get a red square
			ofSetHexColor(0xfd5f4f);
		}
		else {
			//no haar gets a yellow square
			ofSetHexColor(0xeeda00);
		}
		
		//draw person
		ofRect(p->boundingRect.x, p->boundingRect.y, p->boundingRect.width, p->boundingRect.height);
		
		//draw centroid
		ofSetHexColor(0xff0000);
		ofCircle(p->centroid.x, p->centroid.y, 3);
		
		//draw id
		ofSetHexColor(0xffffff);
		char idstr[1024];
		sprintf(idstr, "pid: %d\noid: %d\nage: %d", p->pid, p->oid, p->age );
		ofDrawBitmapString(idstr, p->centroid.x+8, p->centroid.y);													
	}
	ofPopMatrix();
	ofSetHexColor(0xffffff);				
	//ofDrawBitmapString("blobs and optical flow", 5, height - 5 );
}
void ofApp::draw()
{
    ofBackground(0);

    cam.begin();

    ofPushMatrix();
    ofTranslate(- ofGetWidth() / 2, - ofGetHeight() / 2, 0);

    ofNoFill();
    ofSetColor(255);

    // Draw all of the points.
    mesh.draw();

    ofFill();
    ofSetColor(255, 255, 0, 80);

    for (std::size_t i = 0; i < searchResults.size(); ++i)
    {
        std::size_t resultIndex = searchResults[i].first;
        float resultDistance = searchResults[i].second;

        DataType& result = points[resultIndex];

        glm::vec3 resultAsPoint(result[0], result[1], result[2]);

        float normalizedDistance = ofMap(resultDistance, radius * radius, 0, 0, 1, true);

        ofSetColor(255, 255, 0, normalizedDistance * 127);

        ofDrawSphere(resultAsPoint, 5);

        if (MODE_NEAREST_N == mode)
        {
            ofSetColor(255, 127);
            ofDrawBitmapString(ofToString(i), resultAsPoint);
        }
    }

    if (MODE_RADIUS == mode)
    {
        ofNoFill();
        ofSetColor(255, 0, 0, 50);

        glm::vec3 fireflyAsPoint(firefly[0], firefly[1], firefly[2]);

        ofDrawSphere(fireflyAsPoint, radius);
    }

    ofPopMatrix();

    cam.end();

    std::stringstream ss;


    if (MODE_RADIUS == mode)
    {
        ss << "SEARCH MODE (space): RADIUS" << std::endl;
        ss << "       RADIUS (-/=): " << radius;
    }
    else
    {
        ss << "SEARCH MODE (space): NEAREST N" << std::endl;
        ss << "    NEAREST N (-/=): " << nearestN;
    }

    ofDrawBitmapStringHighlight(ss.str(), glm::vec2(30, 30));
}
//--------------------------------------------------------------
void testApp::draw(){
	if( oneShot ){
		ofBeginSaveScreenAsPDF("screenshot-"+ofGetTimestampString()+".pdf", false);
	}
	
	ofSetColor(54);
	ofDrawBitmapString("PDF OUTPUT EXAMPLE", 32, 32);
	if( pdfRendering ){
		ofDrawBitmapString("press r to stop pdf multipage rendering", 32, 92);
	}else{	
		ofDrawBitmapString("press r to start pdf multipage rendering\npress s to save a single screenshot as pdf to disk", 32, 92);
	}
		
		
	ofFill();		
	ofSetColor(54,54,54);
	ofDrawBitmapString("TTF Font embdedded into pdf as vector shapes", 32, 460);
	
	if( oneShot || pdfRendering ){
		font.drawStringAsShapes("Current Frame: ",  32, 500);
		ofSetColor(245, 58, 135);
		font.drawStringAsShapes( ofToString(ofGetFrameNum()), 32 + font.getStringBoundingBox("Current Frame: ", 0, 0).width + 9, 500);
	}else{
		font.drawString("Current Frame: ",  32, 500);	
		ofSetColor(245, 58, 135);		
		font.drawString( ofToString(ofGetFrameNum()), 32 + font.getStringBoundingBox("Current Frame: ", 0, 0).width + 9, 500);		
	}
	
	
	ofSetColor(54,54,54);
	ofDrawBitmapString("Images can also be embedded into pdf", 32, dropZoneRects[0].y - 18);
	
	ofSetRectMode(OF_RECTMODE_CORNER);
	ofNoFill();
	for(int k = 0; k < dropZoneRects.size(); k++){
		ofSetColor(54,54,54);
		ofRect(dropZoneRects[k]);
		ofSetColor(245, 58, 135);		
		ofDrawBitmapString("drop images here", dropZoneRects[k].getCenter().x - 70, dropZoneRects[k].getCenter().y);
	}

	ofSetColor(255);
	for(int j = 0; j < images.size(); j ++){
		if( images[j].width > 0 ){
			
			float tw = 300;
			float th = 200;
			
			if( images[j].getWidth() / images[j].getHeight() < tw / th ){
				tw = th * ( images[j].getWidth() / images[j].getHeight() );
			}else{
				th = tw * ( images[j].getHeight() / images[j].getWidth() );			
			}
			
			images[j].draw(dropZoneRects[j].x, dropZoneRects[j].y, tw, th);
			
		}
	}
	
	//lets draw a box with a trail
	ofSetColor(245, 58, 135);
	
	ofRectangle boxBounds(32, 500, ofGetWidth()-32, 250);
	
	//lets get a noise value based on the current frame
	float noiseX = ofNoise(float(ofGetFrameNum())/600.f, 200.0f);
	float noiseY = ofNoise(float(ofGetFrameNum())/800.f, -900.0f);

	ofNoFill();
	ofBeginShape();
	ofVertexes(boxTrail);
	ofEndShape(false);
	
	ofFill();
	ofSetRectMode(OF_RECTMODE_CENTER);

	ofPushMatrix();
		float x = ofMap( noiseX, 0, 1, boxBounds.x, boxBounds.x + boxBounds.width, true);
		float y = ofMap( noiseY, 0, 1, boxBounds.y, boxBounds.y + boxBounds.height, true);

		ofTranslate(x, y, 0);
		ofRotate(angle);
		ofRect(0, 0, 30, 30);
	ofPopMatrix();	
	
	if( boxTrail.size() == 0 || ( boxTrail.back() - ofPoint(x, y) ).length() > 1.5 ){
		boxTrail.push_back(ofPoint(x, y));
	}
	
	if(boxTrail.size() > 800 ){
		boxTrail.erase(boxTrail.begin(), boxTrail.begin()+1);
	}
	
	if( oneShot ){
		ofEndSaveScreenAsPDF();
		oneShot = false;
	}	
}
Esempio n. 5
0
void RecordScene::draw()
{
    ofPushStyle();
    ofBackground(ofColor::white);
    
    /*
    //Draw background rect for spectrum
    ofSetColor( 230, 230, 230 );
    ofFill();
    ofRect( 0, recordRect.getMaxY(), N * 6, -100 );
    
    //Draw spectrum
    ofSetColor( 0, 0, 0 );
    for (int i=0; i<N; i++) {
        //Draw bandRad and bandVel by black color,
        //and other by gray color
        if ( i == bandRad || i == bandVel ) {
            ofSetColor( 0, 0, 0 ); //Black color
        }
        else {
            ofSetColor( 128, 128, 128 ); //Gray color
        }
        ofRect( 10 + i * 5, recordRect.getMaxY(), 3, -spectrum[i] * 100 );
    }
    */
    
    //Draw cloud
    
    //Move center of coordinate system to the screen center
    ofPushMatrix();
    ofTranslate( ofGetWidth() / 2, ofGetHeight() / 2 );
    
    //Draw points
    ofSetColor( 0, 0, 0 );
    ofFill();
    for (int i=0; i<n; i++) {
        ofCircle( p[i], 2 );
    }
    
    //    ofSetColor(ofColor::yellow);
    //Draw lines between near points
    float dist = 40;	//Threshold parameter of distance
    for (int j=0; j<n; j++) {
        for (int k=j+1; k<n; k++) {
            if ( ofDist( p[j].x, p[j].y, p[k].x, p[k].y )
                < dist ) {
                ofLine( p[j], p[k] );
            }
        }
    }
    
    //Restore coordinate system
    ofPopMatrix();
    
    ofSetColor(ofColor::white);
    ofPoint _p = recordRect.getCenter();
    if(isRecording)
        angleArc.draw(_p.x, _p.y);
    recordbtn.draw(recordRect);

    ofSetColor(ofColor::black);
    
//    path.moveTo(300, 300);
//    path.arc( 0, 0, 200, 200, 0, 271);
////    path.arc(recordRect.getCenter(), recordRect.width+20, recordRect.height+20, 0, endAngle);
    
    if(!isRecording)
        ofDrawBitmapStringHighlight("Press to record your voice expression", 5, 140);
    
    ofPopStyle();
    
    shareData->recordingEnabled = isRecording;
}
Esempio n. 6
0
//--------------------------------------------------------------
void ofApp::drawHelper(){
    
    easyCam.begin();
    
    if (depthTestToggle == true) {
        ofEnableDepthTest();
    }

    
    // Center sphere
    if (boolCenterSphere == true) {
        ofSetColor(0, 0, 0, 255);
        ofMesh sphere = ofMesh::sphere(20, 16, OF_PRIMITIVE_TRIANGLE_STRIP);
//        ofSetColor(255, 255, 255, 255);
        
        sphere.draw();
    }
    
    ofEnableBlendMode(OF_BLENDMODE_ADD);

    
    for (int i = 0; i < nSpheres.size(); i++) {
        
        //        long eyeX = (ofGetWindowWidth() / 3) * cos(ofGetFrameNum() * 0.0008);
        //        long eyeZ = (ofGetWindowWidth() / 2) * sin(ofGetFrameNum() * 0.0008);
        
        //        long eyeX = 0;
        //        long eyeZ = 0;
        //        long eyeY = 0;
        //        centerX = ofGetWindowWidth() / 2 + 1500;
        //        centerY = ofGetWindowHeight() / 2;
        //        centerZ = (ofGetWindowWidth() / 3) * sin(ofGetFrameNum() * 0.00008);
        //        float upX = 0;
        //        float upY = 1;
        //        float upZ = 0;
        //
        //        ofVec3f camPos;
        //        ofVec3f lookAtPos;
        //
        //        camPos = ofVec3f(centerX, centerY, centerZ);
        //        lookAtPos = ofVec3f(eyeX, eyeY, eyeZ);
        //
        //        ofVec3f upVector;
        //        upVector.set(0, 1, 0);
        //
        //        cam.setPosition(camPos);
        //        cam.lookAt(lookAtPos, upVector);
        
        //        cam.begin();
        
        
        ofPushMatrix();
        
        ofTranslate(nSpheres[i].position.x, nSpheres[i].position.y, nSpheres[i].position.z);
        
        // Rotation
//        ofRotateX(ofGetFrameNum() * nSpheres[i].velocity.x * velocityMultiplier);
//        ofRotateY(ofGetFrameNum() * nSpheres[i].velocity.y * velocityMultiplier);
//        ofRotateZ(ofGetFrameNum() * nSpheres[i].velocity.z * velocityMultiplier);
        
        
        nSpheres[i].draw();
        
        
        ofPopMatrix();

        
        //        cam.end();
    }
    
    if (depthTestToggle == true) {
        ofDisableDepthTest();
    }
    
    easyCam.end();
}
Esempio n. 7
0
//--------------------------------------------------------------
void testApp::draw(){
	ofSetColor(255, 255, 255);
    
    ofPushMatrix();
    // draw debug (ie., image, depth, skeleton)
    openNIDevice.drawDebug();
    ofPopMatrix();
    
    ofPushMatrix();
    ofEnableBlendMode(OF_BLENDMODE_ALPHA);
    
    
    
    // iterate through users
    for (int i = 0; i < openNIDevice.getNumTrackedHands(); i++){
        
        // get a reference to this user
        ofxOpenNIHand & hand = openNIDevice.getTrackedHand(i);
        
        // get hand position
        ofPoint & handPosition = hand.getPosition();
        
        // draw a rect at the position
        ofSetColor(255,0,0);
        ofRect(handPosition.x, handPosition.y, 2, 2);
        
        // set depthThresholds based on handPosition
        ofxOpenNIDepthThreshold & depthThreshold = openNIDevice.getDepthThreshold(i); // we just use hand index for the depth threshold index
        
        // draw ROI over the depth image
        ofSetColor(255,255,255);
        depthThreshold.drawROI();
        
        // draw depth and mask textures below the depth image at 0.5 scale
        // you could instead just do pixel maths here for finger tracking etc
        // by using depthThreshold.getDepthPixels() and/or depthThreshold.getMaskPixels()
        // and turn off the textures in the initial setup/addDepthTexture calls
        
        ofPushMatrix();
        ofTranslate(320 * i, 480);
        ofScale(0.5, 0.5);
        depthThreshold.drawDepth();
        depthThreshold.drawMask();
        ofPopMatrix();
        
    }
    
    ofDisableBlendMode();
    ofPopMatrix();
    
    // draw some info regarding frame counts etc
	ofSetColor(0, 255, 0);
	string msg = " MILLIS: " + ofToString(ofGetElapsedTimeMillis()) + " FPS: " + ofToString(ofGetFrameRate()) + " Device FPS: " + ofToString(openNIDevice.getFrameRate());
    
	verdana.drawString(msg, 20, 480 - 20);
    
    
    //--osc
    // display instructions
    ofSetColor(0);
	string buf;
	buf = "sending osc messages to" + string(HOST) + ofToString(PORT);
	ofDrawBitmapString(buf, 10, 20);
	ofDrawBitmapString("move the mouse to send osc message [/mouse/position <x> <y>]", 640, 500);

}
Esempio n. 8
0
void Sentence::draw(){
    
	int i = 0;

	xoff = 0;

	float x = 0;
    
    
    // If there are no start/stop index do not calculate  scale factors
    if(startShine.size() > 0 ) {
        p = floor(10*(startShine[0] + stopShine[0]) / 2);
        r = ofGetWidth() - p;
    
        l = p / 10;
        m = r / 10;
    
        float incr = 1 / l;
    }
    
	myFont->beginBatch();
	while(x <= ofGetWidth()){
		
		
		// Calculate a y value according to noise, map to 
		float y = yStart + ofMap(ofNoise(xoff, yoff), 0, 1, 0,400); // Option #1: 2D Noise
    
		// Set the vertex
		//if(x > 0){
            line.addVertex(ofVec2f(x,y));
			if(i < strLen){

				ofVec2f tanVec = ofVec2f(xPrev,yPrev) - ofVec2f(x,y);

				float yDiff = tanVec.y;
				float xDiff = tanVec.x;

				float arcTan = ofRadToDeg(atan(yDiff / xDiff));
                
                ofPushMatrix();
				ofTranslate(x,y);
				ofRotateZ(arcTan);
               
                float alphaVal = ofMap(x,0,ofGetWidth(),10,255);
               // useScaleFac = false;
                
                float scaleFac2 = incr;
                
                //cout << incr << endl;
                /*
                if(!useScaleFac) {
                    ofScale(scaleFac2,scaleFac2,1);
                   
                }
                else {
                    ofScale(scaleFac2,scaleFac2,1);
                }
                
                */
                
                
                
                
                
                
                 //cout << incr << endl;
                
                //ofSetColor(255-(alphaVal));
                
                // If start/stop index is lower than 0 do nothing set colors and incr to zero
                if(startShine.size()>0) {
                    
                    if(x > startShine[0] * 10 && x < stopShine[0] * 10){
                        
                        // incr = 1;
                        
                        
                    }else{
                        
                        if(x <= p){
                            
                            incr += 1/l;
                            
                        }else{
                            incr -= 1/m;
                        }
                        
                    }
                    
				if((i >= startShine[0] && i< stopShine[0]) || (i >= startShine[1] && i< stopShine[1])|| (i >= startShine[2] && i< stopShine[2])|| (i >= startShine[3] && i< stopShine[3]) || (i >= startShine[4] && i< stopShine[4])
        ){
                    
					ofSetColor(0,col,0,255);
                    ofScale(scaleFac,scaleFac,1);
                    //ofScale(1,1,1);
				}else{
                    ofScale(scaleFac,scaleFac,1);
                    //ofScale(0.8,0.8,1);
					ofSetColor(0,100,0,255);
				}
                    
                }else{
                    ofScale(scaleFac,scaleFac,1);
					//ofScale(0.2,0.2,1);
                    ofSetColor(0,100,0,255);
				}
                
				myFont->drawBatch(letters[i],24, 0, 0);
                
                ofPopMatrix();
			//}
		
		i++;

		}
	

		xPrev = x;
		yPrev = y;
		// Increment x dimension for noise
		//xoff += ofMap(p, 0, ofGetWidth(), 0,0.1);
        xoff += xFactor;

		x += 10;
        
        
	}
    myFont->endBatch();
    
    //yoff += ofMap(ofGetMouseY(), 0, ofGetHeight(), 0.001,0.05);
    yoff += speed;
    ofSetColor(0,100,0,255);
	line.draw();
    
    line.clear();
    
    
} 
void testApp::overlays(int xint, int yint)
{
    if(overlayCnt==0) {

        title.draw("Try to Trace the Lines", "Tratar de trazar las lineas",75);

        ofSetLineWidth(3);
        ofSetColor(255, 64, 64);
        for (int i=0; i< net.numdivs; i++) {
            ofLine(net.vertex(i, i),net.vertex(i+1, i));
            ofLine(net.vertex(i+1, i),net.vertex(i+1, i+1));
        }

        ofSetColor(128, 64, 64);
        ofPoint disp=net.vertex(numOctaves/2, numOctaves/2);
        string report="Unison";
        ofRectangle g=arialLabel.getBoundingBox(report, 0, 0);
        ofSetColor(red);
        arialLabel.drawString(report, disp.x-g.width-50,disp.y-100);
        ofSetColor(blue);
        arialLabel.drawString("Unisono", disp.x-arialLabel.stringWidth("Unisono")-50,disp.y-100+g.height);

        ofSetLineWidth(1);
        ofEnableSmoothing();
        ofLine(disp.x-48, disp.y-98, disp.x, disp.y);
        ofDisableSmoothing();


        ofSetColor(128, 64, 64);
        disp=net.vertex(numOctaves/2, numOctaves/2-1);
        report="Octave Difference";
        g=arialLabel.getBoundingBox(report, 0, 0);
        ofSetColor(red);
        arialLabel.drawString(report, disp.x+50,disp.y+g.height+50);
        ofSetColor(blue);
        arialLabel.drawString("Diferencia de octava", disp.x+50,disp.y+50+g.height*2);

        ofSetLineWidth(1);
        ofEnableSmoothing();
        ofLine(disp.x+50, disp.y+50, disp.x, disp.y);
        ofDisableSmoothing();
        //reducedRatios(xint, yint);
    }
    if(overlayCnt==1) {

        title.draw("Constant ratio", "Relacion constante",75);

        ofSetLineWidth(3);
        ofSetColor(255, 64, 64);
        ofLine(net.vertex(0,0),net.vertex(numOctaves/2, numOctaves));
        ofLine(net.vertex(0,0),net.vertex(numOctaves, numOctaves/2));
        //arialLabel.drawString("2:1", net.vertex(2,4).x, net.vertex(2,4).y);
        ofPushMatrix();
        ofTranslate(net.vertex(2,4).x-10, net.vertex(2,4).y,0);
        ofRotate(-63, 0,0,1);
        ofSetColor(178, 64, 64);
        arialLabel.drawString("2:1 ratio", 0,0);
        ofPopMatrix();
        ofPushMatrix();
        ofTranslate(net.vertex(4,2).x-15, net.vertex(4,2).y,0);
        ofRotate(-27, 0,0,1);
        ofSetColor(178, 64, 64);
        arialLabel.drawString("1:2 ratio", 0,0);
        ofPopMatrix();
    }

    if(overlayCnt==2) {

        title.draw("Constant ratio", "Diferencia constante",75);

        ofSetLineWidth(3);
        ofSetColor(255, 64, 64);
        ofLine(net.vertex(0,0),net.vertex(numOctaves, numOctaves));
        ofLine(net.vertex(0,1),net.vertex(numOctaves-1, numOctaves));
        //arialLabel.drawString("2:1", net.vertex(2,4).x, net.vertex(2,4).y);
        ofPushMatrix();
        ofTranslate(net.vertex(3,4).x-10, net.vertex(3,4).y,0);
        ofRotate(-45, 0,0,1);
        ofSetColor(178, 64, 64);
        arialLabel.drawString("Octave Difference", 0,0);
        ofPopMatrix();
        ofPushMatrix();
        ofTranslate(net.vertex(3,3).x-15, net.vertex(3,3).y,0);
        ofRotate(-45, 0,0,1);
        ofSetColor(178, 64, 64);
        arialLabel.drawString("Unison", 0,0);
        ofPopMatrix();
    }

    if(overlayCnt==3) {

        title.draw("Can you trace the circle?", "Se puede trazar el circulo?",75);

        ofSetLineWidth(3);
        ofSetColor(255, 64, 64);
        ofNoFill();
        ofRect(net.vertex(1, 1),pixOctave*(numOctaves-2),-pixOctave*(numOctaves-2));
        ofSetCircleResolution(60);
        ofCircle(net.vertex(numOctaves/2, numOctaves/2), pixOctave*(numOctaves-2)/2);
        ofSetCircleResolution(20);
        ofFill();
    }
    if(overlayCnt==4) {
        //reducedRatios(xint,yint);

        title.draw("Ratios", "Ratios",75);

        if(dispLines) {
            int xm=xint-(width-sqWid)/2,ym=sqWid-(yint-yOffset);
            nearest_fraction(&xm, &ym,sqWid,numOctaves);

            for(int i=0; i<numOctaves+1; i++) {
                ofPoint k=net.vertex(xm*i, ym*i);
                if(abs(xint-k.x)<20&&abs(yint-k.y)<20) {
                    double xp=xm,yp=ym;

                    if(xp<8&&yp<8) {
                        if(xp>yp) yp*=(8/xp), xp=8;
                        else if(yp>xp) xp*=(8/yp), yp=8;
                        else if(yp=xp) xp=yp=8;
                    }
                    ofEnableSmoothing();
                    ofSetColor(255, 64, 64);
                    ofSetLineWidth(3);
                    ofLine(net.vertex(0, 0),net.vertex(xp, yp));
                    ofDisableSmoothing();
                }
            }
        }
    }
}
Esempio n. 10
0
//--------------------------------------------------------------
void testApp::draw() {
	ofEnableAlphaBlending();

	cam.begin();
	
	ofDrawAxis(100);

	ofFill();

	// draw all markers set
	ofSetColor(255, 128);
	for (int i = 0; i < max(0, (int)natnet.getNumMarkersSet() - 1); i++) {
		for (int j = 0; j < natnet.getMarkersSetAt(i).size(); j++) {
			ofDrawBox(natnet.getMarkersSetAt(i)[j], 3);
		}
	}
	
	// draw all markers
	ofSetColor(255, 30);
	for (int i = 0; i < natnet.getNumMarker(); i++) {
		ofDrawBox(natnet.getMarker(i), 3);
	}

	ofNoFill();

	// draw filtered markers
	ofSetColor(255);
	for (int i = 0; i < natnet.getNumFilterdMarker(); i++) {
		ofDrawBox(natnet.getFilterdMarker(i), 10);
	}

	// draw rigidbodies
	for (int i = 0; i < natnet.getNumRigidBody(); i++) {
		const ofxNatNet::RigidBody &RB = natnet.getRigidBodyAt(i);

		if (RB.isActive())
			ofSetColor(0, 255, 0);
		else
			ofSetColor(255, 0, 0);

		ofPushMatrix();
		glMultMatrixf(RB.getMatrix().getPtr());
		ofDrawAxis(30);
		ofPopMatrix();

		glBegin(GL_LINE_LOOP);
		for (int n = 0; n < RB.markers.size(); n++) {
			glVertex3fv(RB.markers[n].getPtr());
		}
		glEnd();

		for (int n = 0; n < RB.markers.size(); n++) {
			ofDrawBox(RB.markers[n], 5);
		}
	}
	
	// draw skeletons
	for (int j = 0;  j < natnet.getNumSkeleton(); j++) {
		const ofxNatNet::Skeleton &S = natnet.getSkeletonAt(j);
		ofSetColor(0, 0, 255);
		
		for (int i = 0; i < S.joints.size(); i++) {
			const ofxNatNet::RigidBody &RB = S.joints[i];
			ofPushMatrix();
			glMultMatrixf(RB.getMatrix().getPtr());
			ofDrawBox(5);
			ofPopMatrix();
		}
	}

	cam.end();

	string str;
	str += "frames: " + ofToString(natnet.getFrameNumber()) + "\n";
	str += "data rate: " + ofToString(natnet.getDataRate()) + "\n";
	str += string("connected: ") + (natnet.isConnected() ? "YES" : "NO") + "\n";
	str += "num markers set: " + ofToString(natnet.getNumMarkersSet()) + "\n";
	str += "num marker: " + ofToString(natnet.getNumMarker()) + "\n";
	str += "num filtered (non regidbodies) marker: " +
		   ofToString(natnet.getNumFilterdMarker()) + "\n";
	str += "num rigidbody: " + ofToString(natnet.getNumRigidBody()) + "\n";
	str += "num skeleton: " + ofToString(natnet.getNumSkeleton()) + "\n";

	ofSetColor(255);
	ofDrawBitmapString(str, 10, 20);
}
Esempio n. 11
0
//----------------------------------------------------------------------
void game::draw(){  
	////////////////////////////////Draw game steps////////////////////////////////////
	if(step == -1){
		//waiting for initializing touch
	}
	if(step == 0){
		//is waiting for a shape to be selected
		//object menuu is showing
		//it can load an object from menu
		//or from puzzle menu in the middle
	}
	if (step == 1){
		//show selected object
		objectDisplayed->draw();
		//myCutter->draw();
	}
	if(step == 2){
		//waiting for armature to be selected
		//show selected object
		objectDisplayed->draw();
	}
	if(step == 3){
		//armature has been selected
		curRotA.getRotate(angleA, axistbA);
		ofPushMatrix();
		ofTranslate(posP.x,posP.y,posP.z);

		//euler
		ofRotateX(rotateSlicer.x);
		ofRotateY(rotateSlicer.y);
		ofRotateZ(rotateSlicer.z);

		//new trackball
		ofRotate(angleA, axistbA.x, axistbA.y, axistbA.z);

		glGetDoublev(GL_MODELVIEW_MATRIX, model);// here I have the current matrix with the rotations that I need, after rotation has been applied 
		//model has the current model view matrix
		//with it we create an ofMatrix4x4
		ofMatrix4x4 armRotTB = ofMatrix4x4(model[0],model[1],model[2],model[3],model[4],model[5],model[6],model[7],model[8],model[9],model[10],model[11],model[12],model[12],model[14],model[15]);
		//invert matrix
		ofMatrix4x4 inverseArmRotation = ofMatrix4x4::getInverseOf(armRotTB);
		//use inverse matrix to apply rotations
		invRotA = inverseArmRotation.getRotate();
		//now I have a new quaternion with the inverse rotations.. to rotate puzzle back
		invRotA.getRotate(angleAinv, axistbAinv);
		//now I have an angle and a vector to rotate


		ofTranslate(-posP.x,-posP.y,-posP.z);
		myArmature->draw();
		ofPopMatrix();
		//show selected object
		objectDisplayed->draw();
	}
	if(step == 4 ){
		//made the cuts
		//show color palette
		//show puzzle

		curRot.getRotate(angle, axistb);

		ofPushMatrix();
		ofTranslate(posP.x,posP.y,posP.z);
		//new trackball
		ofRotate(angle, axistb.x, axistb.y, axistb.z);
		ofTranslate(-posP.x,-posP.y,-posP.z);
		myPuzzle->draw();
		ofPopMatrix();
	}
	if(step == 5){
		//show puzzle
		curRot.getRotate(angle, axistb);

		ofPushMatrix();
		ofTranslate(posP.x,posP.y,posP.z);
		//new trackball
		ofRotate(angle, axistb.x, axistb.y, axistb.z);


		ofTranslate(-posP.x,-posP.y,-posP.z);
		myPuzzle->draw();

		ofPopMatrix();
	}
	if(step == 6){
		//show drawing area
		myCanvas->draw();
		myCanvasImage.draw(posCanvas.x-500/2,posCanvas.y-500/2,posCanvas.z,500,500);
	}
	if(step == 7){
		//show puzzle
		curRot.getRotate(angle, axistb);

		ofPushMatrix();
		ofTranslate(posP.x,posP.y,posP.z);
		//new trackball
		ofRotate(angle, axistb.x, axistb.y, axistb.z);


		ofTranslate(-posP.x,-posP.y,-posP.z);
		myPuzzle->draw();
		ofPopMatrix();
	}
}
Esempio n. 12
0
//--------------------------------------------------------------
void testApp::draw(){
	ofSetColor(255, 255, 255);
    
    ofPushMatrix();
    // draw debug (ie., image, depth, skeleton)
    openNIDevice.drawDebug();
    ofPopMatrix();
    
    ofPushMatrix();
    // use a blend mode so we can see 'through' the mask(s)
    ofEnableBlendMode(OF_BLENDMODE_ALPHA);
    
    // get number of current users
    int numUsers = openNIDevice.getNumTrackedUsers();
    
    // iterate through users
    for (int i = 0; i < numUsers; i++){
        
        // get a reference to this user
        ofxOpenNIUser & user = openNIDevice.getTrackedUser(i);
        
        // draw the mask texture for this user
        user.drawMask();
        
        // get joint position
        head = user.getJoint(JOINT_HEAD).getProjectivePosition();
        leftHand = user.getJoint(JOINT_LEFT_HAND).getProjectivePosition();
        rightHand = user.getJoint(JOINT_RIGHT_HAND).getProjectivePosition();
        leftFoot = user.getJoint(JOINT_LEFT_FOOT).getProjectivePosition();
        rightFoot = user.getJoint(JOINT_RIGHT_FOOT).getProjectivePosition();
        torso = user.getJoint(JOINT_TORSO).getProjectivePosition();
        
        
        // OSC stuff
        m.setAddress("/nodes");
        m.addIntArg(head.x);
        m.addIntArg(head.y);
        m.addIntArg(leftHand.x);
        m.addIntArg(leftHand.y);
        m.addIntArg(rightHand.x);
        m.addIntArg(rightHand.y);
        m.addIntArg(leftFoot.x);
        m.addIntArg(leftFoot.y);
        m.addIntArg(rightFoot.x);
        m.addIntArg(rightFoot.y);
        sender.sendMessage(m);
        
//        array_head.push_back(head);
//        array_leftFoot.push_back(leftFoot);
//        array_leftHand.push_back(leftHand);
//        array_rightFoot.push_back(rightFoot);
//        array_rightHand.push_back(rightHand);
//        array_torso.push_back(torso);
//        
//        if(array_head.size() > array_size) {
//            array_head.erase(array_head.begin());
//        }
//        
//        if(array_leftHand.size() > array_size) {
//            array_leftHand.erase(array_leftHand.begin());
//        }
//        
//        if(array_leftFoot.size() > array_size) {
//            array_leftFoot.erase(array_leftFoot.begin());
//        }
//        
//        if(array_rightFoot.size() > array_size) {
//            array_rightFoot.erase(array_rightFoot.begin());
//        }
//        
//        if(array_rightHand.size() > array_size) {
//            array_rightHand.erase(array_rightHand.begin());
//        }
//        if(array_torso.size() > array_size) {
//            array_torso.erase(array_torso.begin());
//        }
        // you can also access the pixel and texture references individually:
        
        // TEXTURE REFERENCE
        //ofTexture & tex = user.getMaskTextureReference();
        // do something with texture...
        
        // PIXEL REFERENCE
        //ofPixels & pix = user.getMaskPixels();
        // do something with the pixels...
        
        // and point clouds:
        
        ofPushMatrix();
        // move it a bit more central
        ofTranslate(320, 240, 10);
        user.drawPointCloud();
        
        // you can also access the mesh:
        
        // MESH REFERENCE
        //ofMesh & mesh = user.getPointCloud();
        // do something with the point cloud mesh
        
        ofPopMatrix();
        
    }
    
    ofDisableBlendMode();
    ofPopMatrix();
    
    // draw some info regarding frame counts etc
//	ofSetColor(0, 255, 0);
//	string msg = " MILLIS: " + ofToString(ofGetElapsedTimeMillis()) + " FPS: " + ofToString(ofGetFrameRate()) + " Device FPS: " + ofToString(openNIDevice.getFrameRate());
//    
//	verdana.drawString(msg, 20, openNIDevice.getNumDevices() * 480 - 20);
    
   //ofSetColor(leftHand.y,torso.x/10,rightHand.y*20);
    
    
   
//  draw the ploy circle(sh)
//    ofBeginShape();
//
//    for (int i = 0; i <6; i++){
//        
//            if (i == 0){
//            ofCurveVertex(leftFoot.x,leftFoot.y); // we need to duplicate 0 for the curve to start at point 0
//            ofCurveVertex(leftHand.x,leftHand.y); // we need to duplicate 0 for the curve to start at point 0
//        } else if (i == 5){
//            ofCurveVertex(head.x,head.y);
//            ofCurveVertex(torso.x, torso.y);	// to draw a curve from pt 6 to pt 0
//            ofCurveVertex(rightHand.x,rightHand.y);	// we duplicate the first point twice
//        }else {
//            ofCurveVertex(rightFoot.x,rightHand.y);
//        }
//
//    }
//
//   ofEndShape();
    
    
    //SH group adding parts~
    
    ofSetColor(leftHand.y,torso.x,rightHand.y*2);
    //ofSetColor(255, 255, 255);
    //ofRect(0, 0,1000, 1000);
    
    bg.draw(-200, 0);
    
    ofSetColor(255,255,255);
    ofSetLineWidth(3);
    ofLine(leftHand.x+10, leftHand.y+10, head.x+10, head.y+10);
    ofLine(head.x+20, head.y+10, rightHand.x+10, rightHand.y+15);
    ofLine(rightHand.x+8, rightHand.y+10, rightFoot.x+20, rightFoot.y+10);
    ofLine(rightFoot.x, rightFoot.y, leftFoot.x, leftFoot.y);
    ofLine(leftFoot.x,leftFoot.y, leftHand.x, leftHand.y);

    ofSetColor(255,255,255);
    ofCircle(leftHand.x+20, leftHand.y+20,10);
    ofCircle(rightHand.x+10, rightHand.y+10,6);
    
    
    
    ofSetColor(leftHand.y,torso.x/10,rightHand.y*20);
    ofSetPolyMode(OF_POLY_WINDING_NONZERO);
	ofBeginShape();
    ofVertex(leftFoot.x,leftFoot.y);
    ofVertex(leftHand.x,leftHand.y);
    ofVertex(head.x,head.y);
    ofVertex(rightHand.x,rightHand.y);
    ofVertex(rightFoot.x,rightFoot.y);
	ofEndShape();
	
    
//    for(int i=0; i<array_head.size();i++) {
//        if(i > 1) {
//            ofLine(array_head[i-1].x, array_head[i-1].y, array_head[i].x, array_head[i].y);
//        }
//    }
//    for(int i=0; i<array_leftFoot.size();i++) {
//        if(i > 1) {
//            ofLine(array_leftFoot[i-1].x, array_leftFoot[i-1].y, array_leftFoot[i].x, array_leftFoot[i].y);
//        }
//    }
//    for(int i=0; i<array_rightFoot.size();i++) {
//        if(i > 1) {
//            ofLine(array_rightFoot[i-1].x, array_rightFoot[i-1].y, array_rightFoot[i].x, array_rightFoot[i].y);
//        }
//    }
//    for(int i=0; i<array_leftHand.size();i++) {
//        if(i > 1) {
//            ofLine(array_leftHand[i-1].x, array_leftHand[i-1].y, array_leftHand[i].x, array_leftHand[i].y);
//        }
//    }
//    for(int i=0; i<array_rightHand.size();i++) {
//        if(i > 1) {
//            ofLine(array_rightHand[i-1].x, array_rightHand[i-1].y, array_rightHand[i].x, array_rightHand[i].y);
//        }
//    }
//    for(int i=0; i<array_torso.size();i++) {
//        if(i > 1) {
//            ofLine(array_torso[i-1].x, array_torso[i-1].y, array_torso[i].x, array_torso[i].y);
//        }
//    }
////
//    for (int i=1;i<60 ; i+=10) {
//        CX=i+40;
//        CY=i;
//        ofCircle(CX, CY, 20);
//    }
//    CX=ofRandom(50,400);
//    CY=ofRandom(0,600);
    
   
//  ofCircle(40 ,80, 20);
    //ofSetColor(100);
    ofCircle(100, 100, 20);
    ofCircle(250, 100, 20);
    ofCircle(400, 100, 20);
    
    
    a=rightHand.y;
    
    b=head.y;
    c=leftHand.y;
    
    if (abs(a-b<10)) {
        
        
        la.play();
    }
    if (abs(c-b<10)) {
        so.play();
    }
    if (abs(leftHand.x-100)<10&&abs(leftHand.y-100)<10) {
        Do.play();
    }
    if (abs(leftHand.x-250)<10&&abs(leftHand.y-100)<10) {
        re.play();
    }
    if (abs(leftHand.x-400)<10&&abs(leftHand.y-100)<10) {
        Mi.play();
    }
    if (abs(rightHand.x-100)<10&&abs(rightHand.y-100)<10) {
        Do.play();
    }
    if (abs(rightHand.x-250)<10&&abs(rightHand.y-100)<10) {
        re.play();
    }
    if (abs(rightHand.x-400)<10&&abs(rightHand.y-100)<10) {
        Mi.play();
    }


}
//--------------------------------------------------------------
void ofApp::draw(){
    
    // テクスチャー作成
    ofDisableDepthTest();
    switch (source) {
        case 0:
            envTex = envImage.getTexture();
            break;
            
        case 1:
            if(videoPlayer.isFrameNew()){
                fbo.begin();
                ofClear(0);
                ofEnableArbTex();
                videoPlayer.draw(0, 0, 1920, 960);
                ofDisableArbTex();
                fbo.end();
                envTex = fbo.getTexture();
            }
            break;
            
        case 2:
            if(theta.isFrameNew()){
                fbo.begin();
                ofClear(0);
                equirectShader.begin();
                equirectShader.setUniformTexture("mainTex", theta.getTexture(), 0);
                equirectShader.setUniform1f("radius", 0.445);
                equirectShader.setUniform4f("uvOffset", 0, 0, 0, 0);
                theta.draw(0, 0, 1280, 640);
                equirectShader.end();
                fbo.end();
                envTex = fbo.getTexture();
            }
            break;
            
        default:
            break;
    }
    
    // 描画
    ofEnableDepthTest();
    cam.begin();
    
    envTex.bind();
    envSphere.draw();
    envTex.unbind();
    
    envMapShader.begin();
    envMapShader.setUniformTexture("envMap", envTex, 0);
    envMapShader.setUniformMatrix4f("viewTranspose", ofMatrix4x4::getTransposedOf(cam.getModelViewMatrix()));
    
    switch (object) {
        case 0:
        case 1:
            ofPushMatrix();
            ofTranslate(0, -150);
            for(int i=0; i<model.getNumMeshes(); i++){
                ofPushMatrix();
                ofMultMatrix(model.getMeshHelper(i).matrix);
                ofScale(modelScale.x, modelScale.y, modelScale.z);
                model.getCurrentAnimatedMesh(i).draw();
                ofPopMatrix();
            }
            ofPopMatrix();
            break;
        
        case 2:
            ofDrawSphere(0, 0, 300);
            break;
    }
    
    envMapShader.end();
    cam.end();
}
Esempio n. 14
0
void testApp::draw(){	
	ofSetColor(255, 255, 255);
	
	// draw the debug screens
	ofPushMatrix();
	ofScale(0.5, 0.5);
							
	if (isLive) {
		recordDepth.draw(0, 0, 640, 480);
		recordImage.draw(640, 0, 640, 480);
		if (panel.getValueB("isTracking")) {
			recordUser.draw();
			
			if(panel.getValueB("isMasking")) {
				glEnable(GL_BLEND);
				glBlendFunc(GL_DST_COLOR, GL_ZERO);
				recordUser.drawUserMasks(640, 0);
				glDisable(GL_BLEND);
			}
		}
	}
	else {
		playDepth.draw(0, 0, 640, 480);
		playImage.draw(640, 0, 640, 480);
		if (panel.getValueB("isTracking")) {
			
			playUser.draw();
			
			if(panel.getValueB("isMasking")) {
				glEnable(GL_BLEND);
				glBlendFunc(GL_DST_COLOR, GL_ZERO);
				playUser.drawUserMasks(640, 0);
				glDisable(GL_BLEND);
			}
		}
	}
	
	// draw rectangles to ground the debug screens
	ofNoFill();
	ofRect(0, 0, 640, 480);
	ofRect(640, 0, 640, 480);							
	ofFill();	
	
	ofPopMatrix();
	
	// draw the point cloud
	//glMatrixMode(GL_MODELVIEW);	
	
	
//	glPushMatrix();
//	glTranslatef(320, 240, 0);
//	glRotatef(panel.getValueF("cloud_rotation"), 0, 1, 0);
//	glTranslatef(-320, -240, 0);	
	
	ofPushMatrix();
	ofTranslate(ofGetWidth() / 2, ofGetHeight() / 2, -300);	
	ofRotateY(panel.getValueF("cloud_rotation"));
	ofTranslate(-320, -240, 0);

//	if (panel->getValueB("autoRotate")){
//		ofRotateY(ofGetElapsedTimef()*5);
//	}

	
	
	//glCallList(SCENE); /* draw the scene */
	
	if (isLive) {
		//recordUser.drawPointCloud(!panel.getValueB("cloudMasking"), panel.getValueI("cloud_point_size"));		
		recordUser.drawOrthogonalPointCloud(panel.getValueF("ppm"), false, panel.getValueB("show_scene_box"), panel.getValueI("cloud_point_size"));
		recordUser.drawOrthogonal(panel.getValueF("ppm"));
	}
	else {
		//playUser.drawPointCloud(!panel.getValueB("cloudMasking"), panel.getValueI("cloud_point_size"));
	}


	ofPopMatrix();		
	
	
	ofSetColor(255, 255, 0);
	
	string msg1, msg2, msg3;	//drawBitmapString is limited to some numebr of characters -> is this a bug in 007 or always the case?
	
	msg1 += "Press 's' to start/stop recording\n";
	msg1 += "Press 'p' to toggle playback/live streams\n";
	msg3 += (string)(isLive ? "LIVE STREAM\n" : "PLAY STREAM\n");
	msg3 += (string)(!isRecording ? "READY\n" : "RECORDING\n");

	
	ofDrawBitmapString(msg1, 20, 500);
	ofDrawBitmapString(msg3, 20, 600);
	ofDrawBitmapString(currentFileName, 20, 700);
	
	
}
void testApp::drawUI(){
    
    int borderPadding = 60;
    
    
    ofPushMatrix();{
        ofTranslate(ofGetWindowSize()/2);
        
        
        //INSTRUCTIONS
        for(int i = 0; i < 1; i++){

            ofPushMatrix();
            ofRotate(i*180);
            ofTranslate(0, ofGetWindowHeight()/2 - borderPadding);
            ofRotate(180);
            
            ofScale(0.23, 0.23);
            
            //draw bounding boxes
            ofSetColor(0, 255 * 0.4);
            ofRectangle A = instructions.getStringBoundingBox(instructionA, -instructions.stringWidth(instructionA)/2, 0);
            ofRect(A.x, A.y, A.width, A.height);

            ofRectangle B = instructions.getStringBoundingBox(instructionB, -instructions.stringWidth(instructionB)/2, instructions.getLineHeight());
            ofRect(B.x, B.y, B.width, B.height);
            
            //draw text
            ofSetColor(instructCol);
            instructions.drawString(instructionA, -instructions.stringWidth(instructionA)/2, 0);
            instructions.drawString(instructionB, -instructions.stringWidth(instructionB)/2, instructions.getLineHeight());
            ofPopMatrix();
        }
        
        //STATUS

        int num;
        if(attractorSize < 100){
            num = 2;
        } else if(attractorSize < 200){
            num = 3;
        } else {
            num = 4;
        }
        
        for(int i = 0; i < num; i++){
            ofPushMatrix();
            ofRotate(360/num * i + (ofGetElapsedTimef() * 10));
            ofTranslate(0, attractorSize + attractorSize * 0.1);
            
            statusScale = ofMap(attractorSize, 0, 300, 0.08, 0.23);
            
            ofScale(statusScale, statusScale);
            
            //draw text
            ofSetColor(statusCol);
            status.drawString(statusA, -status.stringWidth(statusA)/2, 0);
            status.drawString(statusB, -status.stringWidth(statusB)/2, status.getLineHeight());
            
            ofPopMatrix();
        }
        
        
        //ZOOM STUFF
        if(zooming){
            
            ofPushStyle();
            ofSetRectMode(OF_RECTMODE_CENTER);
            ofSetColor(zoomSquareCol);
            ofNoFill();
            ofSetLineWidth(zoomSquareThick);
            ofRect(0, 0, zoomSquareWidth, zoomSquareWidth);
            
            ofPopStyle();

        }
        
        
    
    }ofPopMatrix();
    
}
Esempio n. 16
0
//--------------------------------------------------------------
void ofApp::draw(){
    
    //    ofEnableLighting();
    
    cam.begin();
    
    
    
    //    mainLight.enable();
    
    
    //    for (int i=0; i<buildingsPolyline_33975_22294.size(); i++) {
    //        buildingsPolyline_33975_22294[i].draw();
    //    }
    
    //    ofPushStyle();
    //    ofSetColor(255, 160);
    //
    //    for (int i=0; i<buildings_33975_22294.size(); i++) {
    //        vector<ofVec3f> & _v = buildings_33975_22294[i].getVertices();
    //        for (int j=0; j<_v.size(); j++) {
    //            ofDrawLine( _v[j] - ofVec3f(0, 0, 0), _v[j] + ofVec3f(0, 0, 100) );
    //        }
    //    }
    //    ofPopStyle();
    
    
    for (int i=0; i<roadsPolyline_33975_22294.size(); i++) {
        roadsPolyline_33975_22294[i].draw();
    }
    
    
    for (int i=0; i<roadsPolyline_33975_22294.size(); i++) {
        ofDrawCircle(roadsPolyline_33975_22294[i].getPointAtPercent( roadMoving_33975_22294 ) , 2);
    }
    
    
    
    ofPushStyle();
    ofSetColor(255, 180);
    for (int i=0; i<buildingsPolyline_33975_22294.size(); i++) {
        
        buildingsPolyline_33975_22294[i].draw();
        
//                ofBeginShape();
//                vector<ofVec3f>& vertices = buildingsPolyline_33975_22294[i].getVertices();
//                for(int j = 0; j < vertices.size(); j++) {
//                    ofVertex(vertices[j]);
//                }
//                ofEndShape();
//        
//                ofBeginShape();
//                vector<ofVec3f>& verticesUp = buildingsPolyline_33975_22294[i].getVertices();
//                for(int j = 0; j < verticesUp.size(); j++) {
//                    ofVec3f _v = verticesUp[j] + ofVec3f(0, 0, 100);
//                    ofVertex(_v);
//                }
//                ofEndShape();
        
    }
    ofPopStyle();
    
    
    
    //    mainLight.disable();
    
    cam.end();
    
    //    ofDisableLighting();
    
    

    ofPushMatrix();
    
    ofTranslate( mainOffSetXPos, mainOffSetYPos );
    
    baseArch.guideFrames();
    baseArch.drawEdgeCover( ofColor(0) );
    baseArch.guideLines();
    baseArch.guidePoints();
    
    ofPopMatrix();

    
    ofDrawBitmapString("control : w, s, a, d, r, q, e, c, mouse", 10, 20);
    
    
}
Esempio n. 17
0
//--------------------------------------------------------------
void testApp::drawKeyboard() {
    int idx = 0;

    ofPushMatrix();
    ofTranslate(10,60);
    ofPushStyle();
        // White Keys
        ofPushMatrix();
            for(int i=0;i<m_iNumOctaves;i++){
                for(int j=0; j<7;j++){
                    idx = 12*i+2*j;
                    if (j>2) --idx;
                    if (m_vecKeys[idx]) ofSetColor(ofColor::green);
                    else ofSetColor(ofColor::white);
                    ofRect(0,0,9,30);
                    ofTranslate(10,0);
                }
            }
        ofPopMatrix();

        // Black Keys
        ofPushMatrix();
            ofTranslate(5,0);
            for (int i=0;i<m_iNumOctaves;i++){
                for(int j=0; j<5;j++){
                    idx = 12*i + 2*j+1;
                    if (j>1) ++idx;
                    if(j==2) ofTranslate(10,0);
                    if (m_vecKeys[idx]) ofSetColor(ofColor::green);
                    else ofSetColor(ofColor::black);
                    ofRect(0,0,9,15);
                    ofTranslate(10,0);
                }
                ofTranslate(10,0);
            }
        ofPopMatrix();

        ofPushMatrix();
        ofTranslate(0,40);
            // Mod
            ofSetColor(ofColor::black);
            ofRect(0,0,m_iNumOctaves*7*10,10);
            ofSetColor(ofColor::red);
            ofRect(0,0,ofMap(m_iMod,0,127,0,m_iNumOctaves*7*10),10);
            // Pitch
            ofTranslate(0,15);
            ofSetColor(ofColor::black);
            ofRect(0,0,m_iNumOctaves*7*10,10);
            ofSetColor(ofColor::red);
            ofRect(0,0,ofMap(m_iPitch,0,16384,0,m_iNumOctaves*7*10),10);
            // Program
            ofTranslate(0,30);
            ofSetColor(ofColor::white);
            ofDrawBitmapString(m_sText.str(),0,0);
        ofPopMatrix();

        ofPushMatrix();
        ofTranslate(300,-20);
        ofPushStyle();
            ofFill();
            // CutOff
            drawPotentiometer(ofMap(m_iCutOff,0,127,0,TWO_PI));
            ofTranslate(40,0);
            // Resonance
            drawPotentiometer(ofMap(m_iResonance,0,127,0,TWO_PI));
            ofTranslate(40,0);
            // Attack
            drawPotentiometer(ofMap(m_iAttack,0,127,0,TWO_PI));
            ofTranslate(40,0);
            // Release
            drawPotentiometer(ofMap(m_iRelease,0,127,0,TWO_PI));
            ofTranslate(40,0);
            // Tempo
            drawPotentiometer(ofMap(m_fTempo,20,300,0,TWO_PI));
            ofTranslate(40,0);
        ofPopMatrix();
        ofPopStyle();

    ofPopStyle();
    ofPopMatrix();
}
void SceneManager::drawDebug(Depth & depth)
{
	if (player.isLoaded() && isPlayingSequence)
    {
		
		if (isDancerSilhouetteDebugVisible)
		{
			// Draw the video frame
			ofSetColor(255, 255, 255);
			ofPushMatrix();
			ofTranslate(0, ofGetHeight() - srcH * vidScale);
			ofScale(vidScale, vidScale);
			player.draw(0, 0);
			ofPopMatrix();

			// draw blurred
			ofPushMatrix();
			ofTranslate(srcW * vidScale, ofGetHeight() - srcH * vidScale);
			ofScale(vidScale, vidScale);
			dancerFbo[currentVidFbo].draw(0, 0);
			ofPopMatrix();

			// draw CV Grey image
			ofPushMatrix();
			ofTranslate(srcW * 2 * vidScale, ofGetHeight() - srcH * vidScale);
			ofScale(vidScale, vidScale);
			dancerSilhouette.drawCvGreyImg();
			ofPopMatrix();

			// draw contour
			ofPushStyle();
			ofSetColor(255, 0, 0);
			ofPushMatrix();
			ofTranslate(srcW * 3 * vidScale, ofGetHeight() - srcH * vidScale);
			ofScale(vidScale, vidScale);
			dancerSilhouette.drawContour();
			ofPopMatrix();
			ofPopStyle();
		}
    }

	if (isUserSilhouetteDebugVisible)
	{
		// draw blurred
		ofPushMatrix();
		ofTranslate(srcW * vidScale, ofGetHeight() - srcH * vidScale * 2);
		ofScale(vidScale, vidScale);
		userFbo[currentVidFbo].draw(0, 0);
		ofPopMatrix();

		// draw CV Grey image
		ofPushMatrix();
		ofTranslate(srcW * 2 * vidScale, ofGetHeight() - srcH * vidScale * 2);
		ofScale(vidScale, vidScale);
		userSilhouette.drawCvGreyImg();
		ofPopMatrix();

		// draw contour
		ofPushStyle();
		ofSetColor(255, 0, 0);
		ofPushMatrix();
		ofTranslate(srcW * 3 * vidScale, ofGetHeight() - srcH * vidScale * 2);
		ofScale(vidScale, vidScale);
		userSilhouette.drawContour();
		ofPopMatrix();
		ofPopStyle();
	}

	if (isDrawDepth)
		drawDepth(depth, 0, 480 * 0.5);

	if (isDrawClippedDepth)
	{
		ofPushMatrix();
		ofTranslate(0, ofGetHeight() - srcH * vidScale * 2);
		ofScale(vidScale, vidScale);
		drawClippedDepth(0, 0);
		ofPopMatrix();
	}

	if (isDrawLargeClippedDepth)
	{
		ofPushMatrix();
		ofTranslate(640 * 0.5, 0);
		ofScale(largeClippingScale, largeClippingScale);
		depthFbo.draw(0, 0);
		ofPopMatrix();
	}
   
    if (screenRecorder.getIsRecording())
	{
		fastFboReader.readToPixels(depthFbo, pix);
		screenRecorder.addFrame(pix);
	}

	ofPushStyle();
	ofSetColor(0);
	ofPushMatrix();
	ofTranslate(ofGetWidth() - 100, 20);
	screenRecorder.draw();
	ofPopMatrix();
	ofPopStyle();
}
Esempio n. 19
0
void screen0::draw(int x, int y){
	// BEGIN DRAW IN FBO
	votesManager::getInstance()->drawFBOBegin();
	ofBackground(0,0,0);
	ofSetColor(0,0,0);
	ofRect(0,0,(ofGetWidth()-666),ofGetHeight());
	float radius = 360;
	int totalScreens = screensManager::getInstance()->getCurrentTotalScreens();
	float partionForScreen = ofDegToRad((360.0f/((float)totalScreens)));
	ofVec2f centerPos = ofVec2f((ofGetWidth()-666)/2,ofGetHeight()/2);
	int partCount = 0;

	// draw part show already
	if(screensManager::getInstance()->getScreenArId()>0){
		ofSetColor(50,50,50);
		ofBeginShape();
		for(int i=0; i<screensManager::getInstance()->getScreenArId()+1; i++){
			float degrees = partionForScreen * (float)i;
			ofVec2f pos = ofVec2f( radius*cos(degrees) , radius*sin(degrees) );
			float radius3 = radius-65;
			ofVec2f point1 = ofVec2f( centerPos.x+(radius3*cos(degrees)) , centerPos.y+(radius3*sin(degrees)) );
			ofVertex(point1.x,point1.y);
		}
		for(int i=screensManager::getInstance()->getScreenArId(); i>=0; i--){
			float degrees = partionForScreen * (float)i;
			ofVec2f pos = ofVec2f( radius*cos(degrees) , radius*sin(degrees) );
			float radius4 = radius+50;
			ofVec2f point2 = ofVec2f( centerPos.x+(radius4*cos(degrees)) , centerPos.y+(radius4*sin(degrees)) ); 
			ofVertex(point2.x,point2.y);
		}
		ofEndShape();
	}
	
	for(int i=0;i<totalScreens;i++){
		// position in circle
		float degrees = partionForScreen * (float)i;
		ofVec2f pos = ofVec2f( radius*cos(degrees) , radius*sin(degrees) );
		
		// Part
		int secondPart = screensManager::getInstance()->getTotalScreensPart1();
		int thirdPart = (screensManager::getInstance()->getTotalScreensPart1()+screensManager::getInstance()->getTotalScreensPart2());
		
		if( i==0 || secondPart==i || thirdPart==i ){
			if( secondPart==i || thirdPart==i ){ ofSetColor(190,190,190); }else{ofSetColor(255,255,255);}
			float radius3 = radius-65;
			float radius4 = radius+50;
			ofVec2f point1 = ofVec2f( centerPos.x+(radius3*cos(degrees)) , centerPos.y+(radius3*sin(degrees)) );
			ofVec2f point2 = ofVec2f( centerPos.x+(radius4*cos(degrees)) , centerPos.y+(radius4*sin(degrees)) ); 
			ofLine( point1.x, point1.y, point2.x, point2.y);
			double angleText = ofRadToDeg(atan2(point2.y-point1.y, point2.x-point1.x));
			// get total screens per part
			int totalScreensThisPart = 0;
			
			ofSetColor(190,190,190);
			if(i==0){
				totalScreensThisPart = screensManager::getInstance()->getTotalScreensPart1();
				partCount = 1;
			}else if(i==secondPart){
				totalScreensThisPart = screensManager::getInstance()->getTotalScreensPart2();
				partCount = 2;
			}else if(i==thirdPart){
				totalScreensThisPart = screensManager::getInstance()->getTotalScreensPart3();
				partCount = 3;
			}
			
			string partText = translateManager::getInstance()->t("Part");
			partText[0] = toupper(partText[0]);
			string textThisPart = partText+" "+ofToString(partCount)+"["+ofToString(totalScreensThisPart)+"]";
			int withTextThisPart = fontManager::getInstance()->getPixelFont()->stringWidth(textThisPart);
			// draw text of the part
			ofPushMatrix();
			ofTranslate(point1.x,point1.y);	
			ofRotate(angleText);
			ofTranslate(-5-withTextThisPart,0);
			fontManager::getInstance()->getPixelFont()->drawString(textThisPart,0,0);
			ofPopMatrix();
			
		}
		
		// type by colors
		string typeScreen = screensManager::getInstance()->getIdScreenType(i);
		if(typeScreen=="question"){
			ofSetColor(5,143,249);
		}else if(typeScreen=="debate"){
			ofSetColor(255,255,0);
		}else if(typeScreen=="statement"){
			ofSetColor(255,0,240);
		}else{
			ofSetColor(255,0,0);
		}
		
		// represent
		ofEllipse(centerPos.x+pos.x,centerPos.y+pos.y,2,2);
		
		float radius2 = radius+10;
		ofVec2f pos2 = ofVec2f( radius2*cos(degrees) , radius2*sin(degrees) );
		ofLine(centerPos.x+pos.x,centerPos.y+pos.y,centerPos.x+pos2.x,centerPos.y+pos2.y);
		
		// error Link
		if( screensManager::getInstance()->getScreenHasBrokenLinks(i) ){
			ofSetColor(255,0,0);
			float radius3 = radius-5;
			float radius4 = radius-150;
			ofVec2f pos3 = ofVec2f( radius3*cos(degrees) , radius3*sin(degrees) );
			ofVec2f pos4 = ofVec2f( radius4*cos(degrees) , radius4*sin(degrees) );
			ofVec2f point1 = ofVec2f(centerPos.x+pos3.x,centerPos.y+pos3.y);
			ofVec2f point2 = ofVec2f(centerPos.x+pos4.x,centerPos.y+pos4.y);
			ofLine(point1.x,point1.y,point2.x,point2.y);

			string idScreen = ofToString(screensManager::getInstance()->getIdScreen(i));
		
			double angleText = ofRadToDeg(atan2(point2.y-point1.y, point2.x-point1.x))+180.0f;
			//int stringSize = fontManager::getInstance()->getPixelFont()->stringWidth(idScreen);
			ofVec2f posText = ofVec2f(centerPos.x+pos4.x,centerPos.y+pos4.y);
			ofPushMatrix();
			ofTranslate(posText.x,posText.y);	
			ofRotate(angleText);
			ofTranslate(0,-2);
			fontManager::getInstance()->getPixelFont()->drawString(idScreen,0,0);
			ofPopMatrix();
		}
		// show current screen
		if(screensManager::getInstance()->getScreenArId()==i){
			ofSetColor(255,255,255);
			float radius3 = radius-65;
			float radius4 = radius+50;
			ofVec2f pos3 = ofVec2f( radius3*cos(degrees) , radius3*sin(degrees) );
			ofVec2f pos4 = ofVec2f( radius4*cos(degrees) , radius4*sin(degrees) );
			ofVec2f point1 = ofVec2f(centerPos.x+pos3.x,centerPos.y+pos3.y);
			ofVec2f point2 = ofVec2f(centerPos.x+pos4.x,centerPos.y+pos4.y);
			ofLine(point1.x,point1.y,point2.x,point2.y);

			string idScreen = ofToString(screensManager::getInstance()->getIdScreen(i));
			double angleText = ofRadToDeg(atan2(point2.y-point1.y, point2.x-point1.x));
			int stringSize = fontManager::getInstance()->getPixelFont()->stringWidth(idScreen);
			ofVec2f posText = ofVec2f(centerPos.x+pos3.x,centerPos.y+pos3.y);
			ofPushMatrix();
			ofTranslate(posText.x,posText.y);	
			ofRotate(angleText);
			ofTranslate(60-stringSize,-5);
			fontManager::getInstance()->getPixelFont()->drawString(idScreen,0,0);
			ofPopMatrix();
		}

	}
	// Title
	ofSetColor(255,255,255);
	string textTitle = "Screens PdV";
	int stringHalfSize = fontManager::getInstance()->getPixelFont()->stringWidth(textTitle)/2;
	fontManager::getInstance()->getPixelFont()->drawString(textTitle,(ofGetWidth()-666)/2-stringHalfSize,ofGetHeight()/2);
	
	// Total screens
	ofSetColor(90,90,90);
	string totalScreensStr = "total screens:"+ofToString(totalScreens);
	totalScreensStr[0] = toupper(totalScreensStr[0]);
	stringHalfSize = fontManager::getInstance()->getPixelFont()->stringWidth(totalScreensStr)/2;
	fontManager::getInstance()->getPixelFont()->drawString(totalScreensStr,(ofGetWidth()-666)/2-stringHalfSize,(ofGetHeight()/2)+15);

	// Total errors
	if( settingsManager::getInstance()->getDebugMode() ){
		int totalErrors = screensManager::getInstance()->getTotalXMLErrors();
		if(totalErrors>0){
			ofSetColor(255,0,0);
			stringHalfSize = fontManager::getInstance()->getPixelFont()->stringWidth("Total XML errors:"+ofToString(totalErrors))/2;
			fontManager::getInstance()->getPixelFont()->drawString("Total XML errors:"+ofToString(totalErrors),(ofGetWidth()-666)/2-stringHalfSize,(ofGetHeight()/2)+30);
		}else{
			ofSetColor(0,255,0);
			stringHalfSize = fontManager::getInstance()->getPixelFont()->stringWidth("There is no XML errors")/2;
			fontManager::getInstance()->getPixelFont()->drawString("There is no XML errors",(ofGetWidth()-666)/2-stringHalfSize,(ofGetHeight()/2)+30);
		}
	}

	ofPushMatrix();
	ofTranslate(20,-20);
	string typeScreen = "";
	// 
	ofSetColor(5,143,249);
	ofRect(15,ofGetHeight()-65,10,10);
	typeScreen = "question";
	fontManager::getInstance()->getPixelFont()->drawString(typeScreen,30,ofGetHeight()-55);
	
	ofSetColor(255,255,0);
	ofRect(15,ofGetHeight()-50,10,10);
	typeScreen = "debate";
	fontManager::getInstance()->getPixelFont()->drawString(typeScreen,30,ofGetHeight()-40);
	
	ofSetColor(255,0,240);
	ofRect(15,ofGetHeight()-35,10,10);
	typeScreen = "statement or text";
	fontManager::getInstance()->getPixelFont()->drawString(typeScreen,30,ofGetHeight()-25);
	
	if( settingsManager::getInstance()->getDebugMode() ){
		ofSetColor(255,0,0);
		ofRect(15,ofGetHeight()-20,10,10);
		typeScreen = "errors";
		fontManager::getInstance()->getPixelFont()->drawString(typeScreen,30,ofGetHeight()-10);
	}
	ofPopMatrix();

	
	// END DRAW IN FBO
	votesManager::getInstance()->drawFBOEnd();

	// Draw FBO
	ofSetColor(255,255,255);
	votesManager::getInstance()->drawFBO(x,y);
}
void Line::draw() {
    
/* ------------------------------------------------ */
//this is Lauren's code using Connor's logic:
    
    ofPushMatrix();
    ofTranslate(xPos, yPos);
    ofRotateZ(rotation);
    
    ofSetColor(lineColor);
    
    ofBeginShape();
    
    float x0 = 0;
    float x1 = x0 - leafWidth;
    float x2 = x0 - leafWidth/leafCurvature;
    float x3 = x0;
    
    float y0 = 0 - stemLength;
    float y1 = y0 - leafLength/3;
    float y2 = y1 - leafLength/3;
    float y3 = y0 - leafLength;
    
    ofRect(x2, y2, lineWidth, lineLength);
    
    ofEndShape();

    ofPopMatrix();


    
/* ------------------------------------------------ */
//try uncommenting this and playing w your own shapes:
    
//    ofPushMatrix();
//    ofTranslate(xPos, yPos);
//    ofRotateZ(rotation);
//    
//    //draw rect
//    
//    ofSetColor(lineColor);
//    
//    //draw left half of leaf
//    
//    ofBeginShape();
//    
//    float x0 = 0;
//    float x1 = x0 - leafWidth;
//    float x2 = x0 - leafWidth/leafCurvature;
//    float x3 = x0;
//    
//    float y0 = 0 - stemLength;
//    float y1 = y0 - leafLength/3;
//    float y2 = y1 - leafLength/3;
//    float y3 = y0 - leafLength;
//    
//    ofVertex(x0,y0);
//    ofBezierVertex(x1,y1,x2,y2,x3,y3);
//    
//    ofEndShape();
//    
//    //draw right half of leaf
//    
//    ofBeginShape();
//    
//    x0 = 0;
//    x1 = x0 + leafWidth;
//    x2 = x0 + leafWidth/leafCurvature;
//    x3 = x0;
//    
//    y0 = 0 - stemLength;
//    y1 = y0 - leafLength/3;
//    y2 = y1 - leafLength/3;
//    y3 = y0 - leafLength;
//    
//    ofVertex(x0,y0);
//    ofBezierVertex(x1,y1,x2,y2,x3,y3);
//    
//    ofEndShape();
//    
//    ofPopMatrix();

/* ------------------------------------------------ */




}
//-------------------------------------------
void ofxAssimpModelLoader::draw(ofPolyRenderMode renderType) {
    if(scene == NULL) {
        return;
    }
    
    ofPushStyle();
    
    ofPushMatrix();
    ofMultMatrix(modelMatrix);
    
    int curRenderType = -1;
    
    for(unsigned int i=0; i<modelMeshes.size(); i++) {
        ofxAssimpMeshHelper & mesh = modelMeshes[i];
        
        ofPushMatrix();
        ofMultMatrix(mesh.matrix);

        if(bUsingTextures){
            if(mesh.hasTexture()) {
                mesh.getTextureRef().bind();
            }
        }
        
        if(bUsingMaterials){
            mesh.material.begin();
        }

        if(mesh.twoSided) {
            glEnable(GL_CULL_FACE);
        }
        else {
            glDisable(GL_CULL_FACE);
        }
        
        ofEnableBlendMode(mesh.blendMode);
#ifndef TARGET_OPENGLES
        
        //avoid setting it over and over again for the same type.
        if( curRenderType != renderType ){
            glPolygonMode(GL_FRONT_AND_BACK, ofGetGLPolyMode(renderType));
            curRenderType = renderType;
        }
        
        mesh.vbo.drawElements(GL_TRIANGLES,mesh.indices.size());
#else
        switch(renderType){
		    case OF_MESH_FILL:
		    	mesh.vbo.drawElements(GL_TRIANGLES,mesh.indices.size());
		    	break;
		    case OF_MESH_WIREFRAME:
		    	mesh.vbo.drawElements(GL_LINES,mesh.indices.size());
		    	break;
		    case OF_MESH_POINTS:
		    	mesh.vbo.drawElements(GL_POINTS,mesh.indices.size());
		    	break;
        }
#endif
        
        if(bUsingTextures){
            if(mesh.hasTexture()) {
            	 mesh.getTextureRef().unbind();
            }
        }
        
        if(bUsingMaterials){
            mesh.material.end();
        }
        
        ofPopMatrix();
    }
    
    #ifndef TARGET_OPENGLES
        if( curRenderType != OF_MESH_FILL ){
            glPolygonMode(GL_FRONT_AND_BACK, ofGetGLPolyMode(OF_MESH_FILL));
        }
    #endif

    ofPopMatrix();
    ofPopStyle();
}
Esempio n. 22
0
//--------------------------------------------------------------
void testApp::draw(){
	ofBackground( 255, 255, 255 );
	ofSetColor(255,255,255);

	//------(a)--------------------------------------
	// 
	// 		draw a star
	// 
	// 		use poly winding odd
	// 
	shapeA.draw();

	//------(b)--------------------------------------
	// 
	// 		draw a star
	//
	// 		use poly winding nonzero	
	// 
	shapeB.draw();
	
	//------(c)--------------------------------------
	// 
	// 		draw a star dynamically	
	// 
	shapeC.draw();
	
	
	//------(d)--------------------------------------
	// 
	// 		polygon of random points	
	// 
	shapeD.draw();
	
	
	//------(e)--------------------------------------
	// 
	// 		use sin cos and time to make some spirally shape
	// 
	ofPushMatrix();
	ofTranslate(100,300);
	shapeE.draw();
	ofPopMatrix();
	

	
	//------(f)--------------------------------------
	// 
	// 		addCurveVertex
	// 
	shapeF.draw();
	
	ofEnableAlphaBlending();
	shapeFNonCurve.draw();

	ofSetColor(255,255,255);
	for (int i = 0; i < nCurveVertexes; i++){
		if (curveVertices[i].bOver == true) selectedDraggableVertex.draw(curveVertices[i].x, curveVertices[i].y);
		else unselectedDraggableVertex.draw(curveVertices[i].x, curveVertices[i].y);
	}
	ofDisableAlphaBlending();
	
	
	//------(g)--------------------------------------
	// 
	// 		addBezierVertex	
	// 
	shapeG.draw();
	float x0 = 500;
	float y0 = 300;
	float x1 = 550+50*cos(ofGetElapsedTimef()*1.0f);
	float y1 = 300+100*sin(ofGetElapsedTimef()/3.5f);
	float x2 = 600+30*cos(ofGetElapsedTimef()*2.0f);
	float y2 = 300+100*sin(ofGetElapsedTimef());
	float x3 = 650;
	float y3 = 300;
	ofEnableAlphaBlending();
	ofFill();

	selectedDraggableVertex.draw(x0,y0);
	selectedDraggableVertex.draw(x1,y1);
	selectedDraggableVertex.draw(x2,y2);
	selectedDraggableVertex.draw(x3,y3);
	ofDisableAlphaBlending();
	
	

	//------(h)--------------------------------------
	// 
	// 		holes / ofNextContour
	//
	ofSetHexColor(0xd3ffd3);
	ofRect(80,480,140,70);
	ofSetColor(255,255,255);
	shapeH.draw();
	
	
	//------(i)--------------------------------------
	// 
	// 		CSG / ofNextContour
	// 
	ofPushMatrix();
	
	shapeIa.draw();
	
	ofTranslate(100,0,0);

	shapeIb.draw();
	
	ofTranslate(100,0,0);

	shapeIc.draw();
	
	ofPopMatrix();
	//-------------------------------------
	
	
	ofSetHexColor(0x000000);
	ofDrawBitmapString("(a) star\nwinding rule odd", 20,210);
	
	ofSetHexColor(0x000000);
	ofDrawBitmapString("(b) star\nwinding rule nonzero", 220,210);
	
	ofSetHexColor(0x000000);
	ofDrawBitmapString("(c) dynamically\ncreated shape", 420,210);
	
	ofSetHexColor(0x000000);
	ofDrawBitmapString("(d) random points\npoly", 670,210);
	
	ofSetHexColor(0x000000);
	ofDrawBitmapString("(e) fun with sin/cos", 20,410);
	
	ofSetHexColor(0x000000);
	ofDrawBitmapString("(f) addCurveVertex\nuses catmull rom\nto make curved shapes", 220,410);
	
	ofSetHexColor(0x000000);
	ofDrawBitmapString("(g) addBezierVertex\nuses bezier to draw curves", 460,410);
	
	
	ofSetHexColor(0x000000);
	ofDrawBitmapString("(h) nextContour\nallows for holes", 20,610);
	
	ofSetHexColor(0x000000);
	ofDrawBitmapString("(i) nextContour\ncan even be used for CSG operations\nsuch as union and intersection", 260,620);

	ofDrawBitmapString(ofToString((int)ofGetFrameRate()),20,20);
	
	
	
		
}
void TownDashboardRenderer::draw()
{
    ofEnableBlendMode(OF_BLENDMODE_ALPHA);
    //type
    _typeLayerFbo.begin();
    
    ofClear(0, 0, 0, 0);
    ofBackground(0, 0, 0, 0);
    
    searchingStringImage.draw(0, 0);
    ofPushMatrix();

    ofSetColor(0,255,255);
    int maxVisibleCharacters = 14;
    string subString = _townName.length() > maxVisibleCharacters ? _townName.substr(0, maxVisibleCharacters) : _townName;
    if (_townName.length() <= (maxVisibleCharacters))
    {
        int insertWs = maxVisibleCharacters - _townName.length() - 1;
        for(int i = 0; i<insertWs; i++)
        {
            subString.push_back('p');
        }
    }
    else{
        subString += "...";
        _townName = subString;// + "...";
    }
    ofRectangle fullRect = font.getStringBoundingBox(subString, 0, 0);
    int p = 0;//running count
    ofRectangle runningStringDimensions;
    
    float debugXPos = 2600.0f;
    
    for(char &c : _townName)
    {
        int nVal = min(p + 1, (int)subString.length());
        
        string runningString = subString.substr(0, nVal);
        runningStringDimensions = font.getStringBoundingBox(runningString, 0, 0);
        string thisCharString = ofToString(c);
        ofRectangle thisCharDimensions = font.getStringBoundingBox(thisCharString, 0, 0);
        
        float diff = runningStringDimensions.width - thisCharDimensions.width;
        float debugWidth = fullRect.width;
        float dPos = diff / fullRect.width;
        ofVec2f positionOnCurve = spline2D.sampleAt(dPos);
        ofVec2f tangent = getTangent(dPos, spline2D);
        float rot = atan2(tangent.y, tangent.x) * RAD_TO_DEG;
        
        ofPushMatrix();
        
        ofTranslate(positionOnCurve.x, positionOnCurve.y);
        ofRotate(rot, 0, 0, 1);
        font.drawString(thisCharString, 0, 0);
        
        ofPopMatrix();
        
        if(_debugMode)
        {
            //debug stuff off screen
            ofSetColor(255, 0, 255);
            ofDrawRectangle(debugXPos, p * 100, runningStringDimensions.width, runningStringDimensions.height);
            ofSetColor(0, 255, 0);
            ofDrawRectangle(debugXPos + diff, runningStringDimensions.height + (p * 100), thisCharDimensions.width, 3000);
            ofSetColor(0, 0, 0);
            font.drawString(runningString, debugXPos, 50 + (p * 100));
        }
        
        ofPopMatrix();
        ++p;
        
    }
    ofSetColor(255);
    searchingStringImage.draw(0, 0);
    _typeLayerFbo.end();
    
    //drawn the type
    //black pass
    _blackPassFbo.begin();
    ofClear(0, 0, 0, 255);
    ofBackground(0, 0, 0, 255);
    
    _typeLayerFbo.draw(0, 0);
    
    _blackPassFbo.end();
    
    //glow
    glow.clear();
    glow << _blackPassFbo;
    
    
    
    _glowPassFbo.begin();
    ofClear(0, 0, 0);
    ofBackground(0, 0, 0);
    ofRectangle r = ofRectangle(0, 0, PRINT_DIMENSIONS_WIDTH, PRINT_DIMENSIONS_HEIGHT);
    glow.ofxFXObject::draw(r);
    _glowPassFbo.end();
    
    //final render
    _exportFbo.begin();
    
    ofClear(0, 0, 0);
    ofBackground(0, 0, 0);
//    backgroundImage.draw(0, 0);
    blendImage.draw(0, 0);
    _typeLayerFbo.draw(0, 0);

    ofEnableBlendMode(OF_BLENDMODE_ADD);

    _glowPassFbo.draw(0, 0);
    ofEnableBlendMode(OF_BLENDMODE_ALPHA);
    
    _exportFbo.end();
    
}
Esempio n. 24
0
//--------------------------------------------------------------
void ofApp::draw(){

  ofBackground(0);
  ofEnableAlphaBlending();

  // ofFill();

	// draw the debugging X
  if(debug) {
  	areaX[0] = (ofGetWidth() / 2) - (ofGetHeight() / 2);
  	areaX[1] = (ofGetWidth() / 2) + (ofGetHeight() / 2);

	  ofDrawLine(areaX[0], 0, areaX[1], ofGetHeight());
    ofDrawLine(areaX[0], ofGetHeight(), areaX[1], 0);
  }

  // draw to the fbo
  fbo.begin();

    ofClear(0);

    ofPushMatrix();
  	myBicho[bichoActive].draw();

    if(debug) {
      ofSetColor(100);
      ofNoFill();
      // add a frame around the fbo to check boundries
      ofDrawRectangle(1,1,fbo.getWidth()-1,fbo.getHeight()-1);
    }

    ofPopMatrix();

  fbo.end();

  // we don't touch this anymore...
  fbo.setAnchorPercent(.5,.5);

  ofPushMatrix();
    ofTranslate(ofGetWidth() / 2, ofGetHeight() / 2 - safezone);
    ofScale(-1,1,1);
    ofRotate(0);
    fbo.draw(myBicho[bichoActive].bichoX,myBicho[bichoActive].bichoY);
  ofPopMatrix();

  ofPushMatrix();
    ofTranslate(ofGetWidth() / 2 + safezone, ofGetHeight() / 2);
    ofScale(-1,1,1);
    ofRotate(270);
    fbo.draw(myBicho[bichoActive].bichoX,myBicho[bichoActive].bichoY);
  ofPopMatrix();

  ofPushMatrix();
    ofTranslate(ofGetWidth() / 2, ofGetHeight() / 2 + safezone);
    ofScale(-1,1,1);
    ofRotate(180);
    fbo.draw(myBicho[bichoActive].bichoX,myBicho[bichoActive].bichoY);
  ofPopMatrix();

  ofPushMatrix();
    ofTranslate(ofGetWidth() / 2 - safezone, ofGetHeight() / 2);
    ofScale(-1,1,1);
    ofRotate(90);
    fbo.draw(myBicho[bichoActive].bichoX,myBicho[bichoActive].bichoY);
  ofPopMatrix();

  ofDisableAlphaBlending();

  // raw outputs
  if(debug) {
    gui.draw();

    ofDrawBitmapString("bicho: " + ofToString(bichoActive), 30, ofGetHeight() - 120);
    ofDrawBitmapString("total: " + ofToString(bichosTotal), 30, ofGetHeight() - 100);
    ofDrawBitmapString("opacity: " + ofToString(myBicho[bichoActive].bichoOpacity), 30, ofGetHeight() - 80);
    ofDrawBitmapString("x: " + ofToString(myBicho[bichoActive].bichoX), 30, ofGetHeight() - 60);
    ofDrawBitmapString("y: " + ofToString(myBicho[bichoActive].bichoY), 30, ofGetHeight() - 40);
  }

}
Esempio n. 25
0
void demoAdvanced::draw( ) {

    int tx = 0;
    int ty = 0;
    
    ofBackground( 0, 0, 0 );
    
    // quaternion
    ofPushMatrix();

        ofTranslate( ofGetWidth() * 0.5f, ofGetHeight() * 0.5f, -200 );
        
        ofNoFill();
        ofSetColor( 255,255,255 );
        float rotationAmount;
        ofVec3f rotationAngle;
        quaternion.getRotate(rotationAmount, rotationAngle);
        ofRotate(rotationAmount, rotationAngle.x, rotationAngle.y, rotationAngle.z);
        ofBox( 0,0,0, 100, 100, 100 );
        
        ofSetColor( 255,0,0 );
        ofLine( 0,0,0, 100,0,0 );
        ofSetColor( 0,255,0 );
        ofLine( 0,0,0, 0,100,0 );
        ofSetColor( 0,0,255 );
        ofLine( 0,0,0, 0,0,100 );
    
    ofPopMatrix();
    
    // matrix 4x4
    ofPushMatrix();

        ofTranslate( ofGetWidth() * 0.5f, ofGetHeight() * 0.5f, -200 );
        
        ofNoFill();
        ofSetColor( 255,255,255 );
        
        ofMultMatrix( mat );
        ofBox( 0,0,0, 200, 200, 200 );
        
        ofSetColor( 255,0,0 );
        ofLine( 0,0,0, 100,0,0 );
        ofSetColor( 0,255,0 );
        ofLine( 0,0,0, 0,100,0 );
        ofSetColor( 0,0,255 );
        ofLine( 0,0,0, 0,0,100 );
    
    ofPopMatrix();
    
    
    
    ofSetColor( 255,255,255 );
    ty = 25;
    ofDrawBitmapString( "tweener fps: " + ofToString( _tweener->fps() ), 10, ty ); ty += 15;
    ofDrawBitmapString( "tweener time speed: " + ofToString( _tweener->timespeed() ), 10, ty ); ty += 15;
    ofDrawBitmapString( "tweener inner time: " + ofToString( _tweener->innertime() ), 10, ty ); ty += 15;
    if ( _tweener->running() ) {
        ofDrawBitmapString( "tweener is playing", 10, ty ); ty += 15;
    } else {
        ofDrawBitmapString( "tweener is paused", 10, ty ); ty += 15;
    }
    ofDrawBitmapString( "millis: " + ofToString( ofGetElapsedTimeMillis() ), 10, ty ); ty += 15;
    ofDrawBitmapString( "of fps: " + ofToString( ofGetFrameRate() ), 10, ty ); ty += 15;
    
    ofSetColor( 255,255,100 );
    stringstream ss;
    for ( int i = 1; i < lognum; ++i ) {
        ss << logs[ i ] << endl;
    }
    ofDrawBitmapString( ss.str(), 300, 25 );
    
}
Esempio n. 26
0
void ofxLayerMask::beginLayerIsolation() {
    if(layerIsolation == ISOLATE_LAYERS) {
        ofPushMatrix();
        ofPushStyle();
    }
}
Esempio n. 27
0
void ofxTLCurves::drawModalContent(){

	//****** DRAW EASING CONTROLS
	if(!drawingEasingWindow){
    	return;
    }

    ofxTLTweenKeyframe* tweenFrame = (ofxTLTweenKeyframe*) selectedKeyframe;
	if(tweenFrame == NULL){
		if(selectedKeyframes.size() == 0){
			return;
		}
		tweenFrame = (ofxTLTweenKeyframe*)selectedKeyframes[0];
	}

	for(int i = 0; i < easingTypes.size(); i++){
        //TODO turn into something like selectionContainsEaseType();
        //so that we can show the multi-selected easies
        if(easingTypes[i] ==  ((ofxTLTweenKeyframe*)selectedKeyframes[0])->easeType){
            ofSetColor(150, 100, 10);
        }
        else{
            ofSetColor(80, 80, 80);
        }
        ofFill();
        ofRect(easingWindowPosition.x + easingTypes[i]->bounds.x, easingWindowPosition.y + easingTypes[i]->bounds.y,
               easingTypes[i]->bounds.width, easingTypes[i]->bounds.height);
        ofSetColor(200, 200, 200);
        timeline->getFont().drawString(easingTypes[i]->name,
									   easingWindowPosition.x + easingTypes[i]->bounds.x+11,
									   easingWindowPosition.y + easingTypes[i]->bounds.y+10);
        ofNoFill();
        ofSetColor(40, 40, 40);
        ofRect(easingWindowPosition.x + easingTypes[i]->bounds.x,
               easingWindowPosition.y + easingTypes[i]->bounds.y,
               easingTypes[i]->bounds.width, easingTypes[i]->bounds.height);
    }

    for(int i = 0; i < easingFunctions.size(); i++){
        //TODO: turn into something like selectionContainsEaseFunc();
        if(easingFunctions[i] == tweenFrame->easeFunc){
            ofSetColor(150, 100, 10);
        }
        else{
            ofSetColor(80, 80, 80);
        }
        ofFill();
        ofRect(easingWindowPosition.x + easingFunctions[i]->bounds.x, easingWindowPosition.y +easingFunctions[i]->bounds.y,
               easingFunctions[i]->bounds.width, easingFunctions[i]->bounds.height);
        ofSetColor(200, 200, 200);
//        timeline->getFont().drawString(easingFunctions[i]->name,
//                           easingWindowPosition.x + easingFunctions[i]->bounds.x+10,
//                           easingWindowPosition.y + easingFunctions[i]->bounds.y+15);
		ofPushMatrix();
		ofTranslate(easingWindowPosition.x + easingFunctions[i]->bounds.x,
					easingWindowPosition.y + easingFunctions[i]->bounds.y);
		if(tweenFrame->easeType->type == ofxTween::easeIn){
			easingFunctions[i]->easeInPreview.draw();
		}
		else if(tweenFrame->easeType->type == ofxTween::easeOut){
			easingFunctions[i]->easeOutPreview.draw();
		}
		else {
			easingFunctions[i]->easeInOutPreview.draw();
		}

		ofPopMatrix();
        ofNoFill();
        ofSetColor(40, 40, 40);
        ofRect(easingWindowPosition.x + easingFunctions[i]->bounds.x, easingWindowPosition.y +easingFunctions[i]->bounds.y,
               easingFunctions[i]->bounds.width, easingFunctions[i]->bounds.height);
    }

}
Esempio n. 28
0
//-------------------------------
void ofxLabGui::draw(){
    if( hidden ) return;

    ofPushStyle();
    ofEnableAlphaBlending();

        float panelH = boundingBox.height;
        if( minimize ){
            panelH = 20;
        }

		if (bDrawBarOnTop || panels.size() == 0){
			glPushMatrix();
				glTranslatef(boundingBox.x, boundingBox.y, 0);
				//draw the background
				ofFill();
				glColor4fv(bgColor.getColorF());
				ofRect(0, 0, boundingBox.width, panelH);

				//draw the outline
				ofNoFill();
				glColor4fv(outlineColor.getColorF());
				ofRect(0, 0, boundingBox.width, panelH);
				ofLine(0, 20, boundingBox.width, 20);
			glPopMatrix();
		} else {
			glPushMatrix();
				glTranslatef(boundingBox.x, (int) boundingBox.y + panels[0]->getPosY(), 0);
					//draw the background
				ofFill();
				glColor4fv(bgColor.getColorF());
				ofRect(0, 0, boundingBox.width, (int) panelH - panels[0]->getPosY());

				//draw the outline
				ofNoFill();
				glColor4fv(outlineColor.getColorF());
				ofRect(0, 0, boundingBox.width, (int) panelH - panels[0]->getPosY());
				ofLine(0, 20, boundingBox.width, 20);
			glPopMatrix();
		}

		if (bCollapsible) ofRect(minimizeButton.x, minimizeButton.y, minimizeButton.width, minimizeButton.height);
		saveButton->render();
		restoreButton->render();
		loadButton->render();
		saveAsButton->render();
        ofPushMatrix();
            ofTranslate(2,0,0);
            glColor4fv(textColor.getColorF());
            guiBaseObject::renderText();
        ofPopMatrix();

        if( !minimize ){

            //don't let gui elements go out of their panels
            //glEnable(GL_SCISSOR_TEST);
            //glScissor(boundingBox.x, ofGetHeight() - ( boundingBox.y + boundingBox.height - (-2 + topSpacing) ), boundingBox.width - borderWidth , boundingBox.height);
			//glScissor(boundingBox.x-1, ofGetHeight() - ( boundingBox.y + boundingBox.height+1 ), boundingBox.width+2, boundingBox.height+2);
                /*for(int i = 0; i < panelTabs.size(); i++){
                    if( i == selectedPanel){
                        ofPushStyle();
                            ofFill();
                            glColor4fv(fgColor.getSelectedColorF());
							ofBeginShape();
							ofVertex(panelTabs[i].x, panelTabs[i].y+panelTabs[i].height);
							ofVertex(panelTabs[i].x, panelTabs[i].y);
							ofVertex(panelTabs[i].x+panelTabs[i].width, panelTabs[i].y);
							ofVertex(panelTabs[i].x+panelTabs[i].width, panelTabs[i].y + panelTabs[i].height);
							ofEndShape(false);
                            //ofRect(panelTabs[i].x, panelTabs[i].y, panelTabs[i].width, panelTabs[i].height);
                            glColor4fv(outlineColor.getColorF());
                        ofPopStyle();
                    }
                    glColor4fv(outlineColor.getColorF());
                    ofNoFill();
					ofBeginShape();
					ofVertex(panelTabs[i].x, panelTabs[i].y+panelTabs[i].height);
					ofVertex(panelTabs[i].x, panelTabs[i].y);
					ofVertex(panelTabs[i].x+panelTabs[i].width, panelTabs[i].y);
					ofVertex(panelTabs[i].x+panelTabs[i].width, panelTabs[i].y + panelTabs[i].height);
					ofEndShape(false);
					//ofRect(panelTabs[i].x, panelTabs[i].y, panelTabs[i].width, panelTabs[i].height);
                }*/

                glPushMatrix();
                    glTranslatef(hitArea.x, hitArea.y, 0);
                    for(int i = 0; i < panels.size(); i++){
                        if( i == selectedPanel )panels[i]->render();
						else panels[i]->renderTab();
                    }
                glPopMatrix();

            //glDisable(GL_SCISSOR_TEST);
        }

    ofPopStyle();
}
Esempio n. 29
0
void of3dLevelScene::draw()
{
    post.begin(cam);
    ofEnableLighting();
//    cam.begin();
    light.enable();
    glEnable(GL_FOG);
    ofBackground(0,0,127);
    
    // level
    if(level.getNumMeshes()) {
        level.drawFaces();
    }
    
    // player
    player->draw();
    
    float drawDistSqrd = 100.f;
    // chests
    for(int i = 0; i < chests.size(); i++) {
        // prevent crash? too many objects??
        if(chests.at(i)->position.distanceSquared(player->position) < drawDistSqrd) {
            chests.at(i)->draw();
        }
    }
    
    // enemies
    for(int i = 0; i < enemies.size(); i++) {
        // prevent crash? too many objects??
        if(enemies.at(i)->position.distanceSquared(player->position) < drawDistSqrd) {
            enemies.at(i)->draw();
        }
    }
    
    glDisable(GL_FOG);
//    ofDrawAxis(20);
//    light.draw();
    //    if(collision.getNumMeshes()) {
    //        collision.drawFaces();
    //    }

    
    if(editMode) {
        ofPushMatrix();
        ofTranslate(cam.getGlobalPosition().x, cam.getGlobalPosition().y, 0.f);
        ofDrawAxis(1);
        ofPopMatrix();
    }
    
    cam.end();
    post.end();
    light.disable();
    ofDisableLighting();
    
    ofSetColor(255,255,255);
    if(gui->isVisible()) {
        gui->draw();
    }
    
    if(editMode) {
        ofSetColor(255,255,255);
        ofDrawBitmapString("edit mode active", 20, 20);
        ofSetColor(200,200,255);
        ofDrawBitmapString("object: " + currentObject, 20, 40);
        ofSetColor(255,255,255);
    }
}
Esempio n. 30
0
void gpuPictoString::drawForPdf(){

    int w = testApp::getInstance()->getW();
    int h = testApp::getInstance()->getH();
    
    int total = gpuPicto::totalPicto;
    
    ofTexture& postex = posPingPong.dst->getTextureReference(); // pos.x, y, alpha
    int texw = postex.getWidth();
    int texh = postex.getHeight();

    ofFloatPixels pix;
    pix.allocate(texw, texh, OF_PIXELS_RGBA);
    postex.readToPixels(pix);

    ofFloatPixels iconPrmPix;
    iconPrmPix.allocate(texw, texh, OF_PIXELS_RGBA);
    iconPrmTex.readToPixels(iconPrmPix);
    
    float iconSize = prm.iconSize*h/128.0;


//    wanring
//
//    Color of svg parts will go white when we push style.
//    So we do not push style here
//
//    glPushAttrib(GL_ALL_ATTRIB_BITS);
//    ofPushStyle();

    ofBackground(testApp::gprm.bg);

    ofDisableAlphaBlending();
    ofDisableSmoothing();

    //ofFill();
    //ofSetColor(100,100,20);
    //ofRect(100,100, 300,300);

    ofSetRectMode(OF_RECTMODE_CENTER);

    int count = 0;
    for(int i=0; i<texh; i++){        
        for(int j=0; j<texw; j++){
            
            // position, alpha
            ofFloatColor posa = pix.getColor(j, i);
            float x = posa.r * w;
            float y = posa.g * h;
            float a = posa.b * 255.0;
    
            // iconPrm
            ofFloatColor iconPrm = iconPrmPix.getColor(j, i);
            int colorType = iconPrm.r*100;
            int iconType = iconPrm.g*100;
            if(iconType>numIcon-1){ iconType = numIcon-1; }
            
            // draw svg
            ofPushMatrix();
            ofTranslate(x, y, 0);
            ofScale(iconSize, iconSize, 1);
            
            ofFill();
            ofSetColor(colors[colorType].r, colors[colorType].g, colors[colorType].b, a);
            svg[iconType].draw();
            ofPopMatrix();

            count++;
            if(count>=total) break;
        }

        if(count>=total) break;
    }

    ofSetRectMode(OF_RECTMODE_CORNER);

}