示例#1
0
//-------------------------------------------------------------- draw
void MonsterScene::draw() {

	ofPushStyle();
	ofEnableAlphaBlending();

	
	//float scalex = (float)RM->getWidth() / (float)cvData[0]->width;
	//float scaley = (float)RM->getHeight() / (float)cvData[0]->height;
	
	if(bDebug) {
	//	ofSetColor(0, 25, 255);
	//	ofFill();
	//	ofRect(-300, -500, 10000, 10000);
	}
	
	
	// --------------------- People
	glPushMatrix();
	glTranslatef(0 , 0, 0);
	//glTranslatef(((RM->getWidth() - W)/2), (RM->getHeight()-H), 0);

	bool bDrawPeople = false;
	if(bDrawPeople) {
        
        for (int packetId = 0; packetId < 2; packetId++){
            for(int i=0; i<cvData[packetId]->blobs.size(); i++) {
                ofSetColor(255, i*20, 255-(i*40), 100);
                ofFill();

                ofBeginShape();
                for (int j = 0; j < cvData[packetId]->blobs[i].blob.size(); j++) {

                    float x = cvData[packetId]->blobs[i].blob[j].x;
                    float y = cvData[packetId]->blobs[i].blob[j].y;

                    ofPoint pt(x,y);
                    cvData[packetId]->remapForScreen(packetId == 0 ? SCREEN_LEFT : SCREEN_RIGHT, pt);
                    ofVertex(pt.x, pt.y);
                }
                ofEndShape(true);
            }
        }
	}



	for(int i=0; i<dust.size(); i++) {
		dust[i].draw();
	}

	for(int i=0; i<balls.size(); i++) {
		balls[i]->draw();
	}


	// --------------------- particles
	for(int i=0; i<monsterParticles.size(); i++) {
		monsterParticles[i]->draw();
	}


	// --------------------- Monsters
	for(int i = 0; i < monsters.size(); i++) {
		monsters[i].draw();
	}


	// --------------------- building shape
	if(bDebug) {
//		for(int i=0; i<box2dBuilding.size(); i++) {
//			//box2dBuilding[i].draw();
//		}
	}


	// --------------------- building shape
	if(bDebug) {
		for(int i=0; i<windowPnts.size(); i++) {
			windowPnts[i].draw();
		}
	}
	glPopMatrix();



	// ferry building only for setup (hide when live)
//	if(bDebug) {
//		ferryBuilding.drawContour();
//		ferryBuilding.drawInfo();
//	}
	ofDisableAlphaBlending();
	ofPopStyle();
    
    
    for (int i=0; i<edges.size(); i++) {
        //edges[i].get()->draw();
    }
}
示例#2
0
void Frog::draw() {
	
	ofPushMatrix(); // save translation matrix
	
	ofTranslate(x, y);
	ofRotateZ(angle);
	ofScale(scale, scale, 1);
	ofTranslate(-11, -7);	// translate back 1/2 of size of frog
	
	//ofNoFill();
	//ofRect(0, 0, 22, 15);
	
	
	// Draw frog body
	ofSetColor(32, 219, 36);
	ofFill();
	ofBeginShape();
	ofVertex(9, 1);
	ofVertex(13, 1);
	ofVertex(14, 4);
	ofVertex(17, 6);
	ofVertex(18, 5);
	ofVertex(18, 1);
	ofVertex(21, 3);
	ofVertex(19, 4);
	ofVertex(19, 8);
	ofVertex(16, 7);
	ofVertex(19, 9);
	ofVertex(20, 10);
	ofVertex(21, 14);
	ofVertex(18, 15);
	ofVertex(18, 11);
	ofVertex(15, 10);
	ofVertex(13, 13);
	ofVertex(8, 13);
	ofVertex(7, 11);
	ofVertex(5, 10);
	ofVertex(4, 15);
	ofVertex(1, 13);
	ofVertex(3, 11);
	ofVertex(4, 8);
	ofVertex(6, 9);
	ofVertex(6, 7);
	ofVertex(3, 7);
	ofVertex(3, 4);
	ofVertex(1, 3);
	ofVertex(5, 1);
	ofVertex(4, 6);
	ofVertex(8, 4);
	ofVertex(9, 1);
	ofEndShape();
	
	// Draw yellow spot on back
	ofSetColor(248, 235, 21);
	ofBeginShape();
	ofVertex(10, 3);
	ofVertex(12, 3);
	ofVertex(14, 11);
	ofVertex(9, 11);
	ofVertex(14, 11);
	ofVertex(8, 5);
	ofVertex(9, 3);
	ofEndShape();
	
	// Draw eyes
	ofSetColor(253, 3, 217);
	ofCircle(7, 3, 2);
	ofCircle(15, 3, 2);
	
	
	ofPopMatrix();	
}
void Leaf::draw(float _xPos, float _yPos){
    
    ofPushMatrix();
    ofSetLineWidth(1);
    ofTranslate(_xPos, _yPos);
    ofScale(scaleFactor, scaleFactor);
    ofRotateZ(rotation);
    
    //draw leaf
    
    ofSetColor(leafColor);
    
    //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 middle part of leaf
    ofBeginShape();
    
    x0 = 0;
    x1 = x0 - leafWidth;
    x2 = x0 - leafWidth/leafCurvature;
    x3 = x0;
    
    y0 = 0 - stemLength;
    y1 = y0 - leafLength/3;
    y2 = y1 - leafLength/2;
    y3 = y0 - leafLength/2;
    
    ofVertex(x0,y0);
    ofBezierVertex(x1,y1,x2,y2,x3,y3);
    
    ofEndShape();
    
    //draw right half of leaf
    
    ofBeginShape();
    
    x0 = 0; //don't need to redefine as float, because we are just reusing the variables created above
    x1 = x0 + leafWidth;
    x2 = x0 + leafWidth/leafCurvature;
    x3 = x0 + leafWidth/3;
    
    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();
    
    //draw stem and veins of leaf
    
    ofSetColor(stemColor);
    ofRect(0,0 - (stemLength/2), stemWidth, stemLength); //MATH!
    
    ofTriangle(0 - stemWidth/2, 0 - stemLength, 0 + stemWidth/2, 0 - stemLength, 0, 0 - stemLength - 3*(leafLength/4));
    
    cout << "x1 = ";
    cout << x1 << endl;
    cout << "x2 = ";
    cout << x2 << endl;
    
    ofPopMatrix();

    
    
}
示例#4
0
//--------------------------------------------------------------
void testApp::draw(){
	
	ofSetColor(225);
	ofDrawBitmapString("AUDIO INPUT EXAMPLE", 32, 32);
	ofDrawBitmapString("press 's' to unpause the audio\n'e' to pause the audio", 31, 92);
	
	ofNoFill();
	
	// draw the left channel:
	ofPushStyle();
		ofPushMatrix();
		ofTranslate(32, 170, 0);
			
		ofSetColor(225);
		ofDrawBitmapString("Left Channel", 4, 18);
		
		ofSetLineWidth(1);	
		ofRect(0, 0, 512, 200);

		ofSetColor(245, 58, 135);
		ofSetLineWidth(3);
					
			ofBeginShape();
			for (size_t i = 0; i < left.size(); i++){
				ofVertex(i*2, 100 -left[i]*180.0f);
			}
			ofEndShape(false);
			
		ofPopMatrix();
	ofPopStyle();

	// draw the right channel:
	ofPushStyle();
		ofPushMatrix();
		ofTranslate(32, 370, 0);
			
		ofSetColor(225);
		ofDrawBitmapString("Right Channel", 4, 18);
		
		ofSetLineWidth(1);	
		ofRect(0, 0, 512, 200);

		ofSetColor(245, 58, 135);
		ofSetLineWidth(3);
					
			ofBeginShape();
			for (size_t i = 0; i < right.size(); i++){
				ofVertex(i*2, 100 -right[i]*180.0f);
			}
			ofEndShape(false);
			
		ofPopMatrix();
	ofPopStyle();
	
	// draw the average volume:
	ofPushStyle();
		ofPushMatrix();
		ofTranslate(565, 170, 0);
			
		ofSetColor(225);
		ofDrawBitmapString("Scaled average vol (0-100): " + ofToString(scaledVol * 100.0, 0), 4, 18);
		ofRect(0, 0, 400, 400);
		
		ofSetColor(245, 58, 135);
		ofFill();		
		ofCircle(200, 200, scaledVol * 190.0f);
		
		//lets draw the volume history as a graph
		ofBeginShape();
		for (size_t i = 0; i < volHistory.size(); i++){
			if( i == 0 ) ofVertex(i, 400);

			ofVertex(i, 400 - volHistory[i] * 70);
			
			if( i == volHistory.size() -1 ) ofVertex(i, 400);
		}
		ofEndShape(false);		
			
		ofPopMatrix();
	ofPopStyle();
	
	drawCounter++;
	
	ofSetColor(225);
	string reportString = "buffers received: "+ofToString(bufferCounter)+"\ndraw routines called: "+ofToString(drawCounter)+"\nticks: " + ofToString(soundStream.getTickCount());
	ofDrawBitmapString(reportString, 32, 589);
		
}
//--------------------------------------------------------------
void ofApp::draw(){

    ofBackground(235, 180, 68);
    ofSetColor(255);
    background.draw(-165, -8);
    ofSetColor(255);
    orangeBackground.draw(273,221);
    
 
   
    for(int i=0; i<numLines; i++){
        lines[i].draw();
    }
    for(int i=0; i<numLittleSquares; i++){
        dressSquares[i].draw();
    }
    //image of green circle on dress
    ofSetColor(255);
    ofEnableAlphaBlending();
    greenCircle.draw(376.496,333);

    for(int i=0; i<numSmallCircles; i++){
        smallCircles[i].draw();
    }
    for(int i=0; i<numBigCirclesDress; i++){
        //check to see if they have overlapped
        bigCircles[i].draw();
    }
        ofBeginShape();
        ofVertex(132,213);
        ofBezierVertex(132,213,137,172,137,163);
        ofBezierVertex(136,154,124,87,133,73);
        ofBezierVertex(142,58,159,27,166,26);
        ofBezierVertex(174,24,180,22,183,20);
        ofBezierVertex(186,18,189,15,212,9);
        ofBezierVertex(236,3,261,-2,267,-3);
        ofBezierVertex(273,-3,294,-9,303,-9);
        ofBezierVertex(312,-9,364,-9,388,-8);
        ofBezierVertex(413,-7,450,0,462,5);
        ofBezierVertex(474,9,506,31,515,45);
        ofBezierVertex(524,58,534,67,536,75);
        ofBezierVertex(538,83,541,90,545,96);
        ofBezierVertex(549,102,555,133,555,133);
        ofBezierVertex(555,133,555,159,554,163);
        ofBezierVertex(554,167,544,195,540,207);
        ofBezierVertex(536,219,531,239,532,245);
        ofBezierVertex(534,251,543,295,550,311);
        ofBezierVertex(558,327,572,369,576,373);
        ofBezierVertex(580,378,582,397,584,401);
        ofBezierVertex(585,406,594,451,594,457);
        ofBezierVertex(594,464,592,488,592,495);
        ofBezierVertex(593,501,597,527,603,537);
        ofBezierVertex(609,546,616,564,616,568);
        ofBezierVertex(616,572,613,583,622,593);
        ofBezierVertex(632,602,624,615,624,619);
        ofBezierVertex(625,623,631,635,629,641);
        ofBezierVertex(627,648,618,662,618,668);
        ofBezierVertex(618,674,625,692,632,700);
        ofBezierVertex(638,708,637,739,637,739);
        ofBezierVertex(637,739,610,738,585,752);
        ofBezierVertex(559,765,531,789,516,794);
        ofBezierVertex(501,798,490,792,486,798);
        ofBezierVertex(481,804,462,824,451,830);
        ofBezierVertex(441,836,361,858,352,855);
        ofBezierVertex(343,852,321,860,306,861);
        ofBezierVertex(291,863,264,870,250,863);
        ofBezierVertex(237,855,229,849,220,849);
        ofBezierVertex(211,849,190,849,183,840);
        ofBezierVertex(175,831,168,797,166,788);
        ofBezierVertex(165,779,145,734,145,720);
        ofBezierVertex(145,707,138,687,138,677);
        ofBezierVertex(138,666,133,659,133,648);
        ofBezierVertex(133,638,130,620,130,620);
        ofBezierVertex(130,620,131,599,131,594);
        ofBezierVertex(130,589,126,571,126,565);
        ofBezierVertex(126,560,127,544,127,544);
        ofBezierVertex(127,544,123,528,123,523);
        ofBezierVertex(123,517,125,481,125,470);
        ofBezierVertex(125,459,118,406,119,386);
        ofBezierVertex(121,365,127,246,127,238);
        ofBezierVertex(128,230,132,213,132,213);

        
        ofNextContour(true);
        //beginning point
        ofFill();
   
        ofVertex(471,309);
        ofBezierVertex(471,309,435,309,412,309);
        ofBezierVertex(389,309,334,298,334,298);
        ofBezierVertex(334,298,328,314,325,330);
        ofBezierVertex(322,346,333,372,333,387);
        ofBezierVertex(333,402,331,416,331,426);
        ofBezierVertex(331,436,350,493,358,510);
        ofBezierVertex(366,527,381,560,385,568);
        ofBezierVertex(389,576,381,613,381,627);
        ofBezierVertex(381,641,398,662,400,675);
        ofBezierVertex(402,688,386,739,382,753);
        ofBezierVertex(378,767,380,798,380,798);
        ofVertex(472,796);
        ofBezierVertex(472,796,472,752,473,740);
        ofBezierVertex(474,728,460,681,455,673);
        ofBezierVertex(450,665,446,652,446,644);
        ofBezierVertex(446,636,464,598,466,587);
        ofBezierVertex(468,576,463,548,459,536);
        ofBezierVertex(455,524,448,496,450,487);
        ofBezierVertex(452,478,472,382,475,366);
        ofBezierVertex(478,350,475,309,475,309);
        ofVertex(471,309);
        ofEndShape();

      
    //image of arm
    ofSetColor(255);
    ofEnableAlphaBlending();
    arm.draw(329, 274);
    //image of under spirals
    ofSetColor(255);
    ofEnableAlphaBlending();
    spiralBackground.draw(424,203,291, 820);
    
    //heads image
    ofSetColor(255);
    heads.draw(210,-5);
    
    //spiral
    for(int i=0; i<numSpirals; i++){
        spirals[i].draw();
    }
    
//    ofPushMatrix();
//    ofTranslate(100,300,0);
//    ofSetHexColor(0xff2220);
//    ofFill();
//    ofSetPolyMode(OF_POLY_WINDING_ODD);
//    ofBeginShape();
//    float angleStep 	= TWO_PI/(100.0f + sin(ofGetElapsedTimef()/5.0f) * 60);
//    float radiusAdder 	= 0.5f;
//    float radius 		= 0;
//    for (int i = 0; i < 200; i++){
//        float anglef = (i) * angleStep;
//        float x = radius * cos(anglef);
//        float y = radius * sin(anglef);
//        ofVertex(x,y);
//        radius 	+= radiusAdder;
//    }
//    ofEndShape();
//    ofPopMatrix();
 
// guy image
    ofSetColor(255);
    ofEnableAlphaBlending();
    man.draw(-165, -8);
    
   
    
    
}
示例#6
0
//--------------------------------------------------------------
void testApp::draw(){

	ofFill();
	ofSetColor(0xe0be21);

	//------(a)--------------------------------------
	// 
	// 		draw a star
	//
	// 		use poly winding odd, the default rule
	//
	// 		info about the winding rules is here:
	//		http://glprogramming.com/red/images/Image128.gif
	// 
	ofSetPolyMode(OF_POLY_WINDING_ODD);	// this is the normal mode
	ofBeginShape();
		ofVertex(200,135);
		ofVertex(15,135);
		ofVertex(165,25);
		ofVertex(105,200);
		ofVertex(50,25);
	ofEndShape();
	
	
	//------(b)--------------------------------------
	// 
	// 		draw a star
	//
	// 		use poly winding nonzero
	//
	// 		info about the winding rules is here:
	//		http://glprogramming.com/red/images/Image128.gif
	// 
	ofSetColor(0xb5de10);
	ofSetPolyMode(OF_POLY_WINDING_NONZERO);
	ofBeginShape();
		ofVertex(400,135);
		ofVertex(215,135);
		ofVertex(365,25);
		ofVertex(305,200);
		ofVertex(250,25);
	ofEndShape();
	//-------------------------------------
	
	
	
	//------(c)--------------------------------------
	// 
	// 		draw a star dynamically
	//
	// 		use the mouse position as a pct
	//		to calc nPoints and internal point radius
	//
	float xPct = (float)(mouseX) / (float)(ofGetWidth());
	float yPct = (float)(mouseY) / (float)(ofGetHeight());
	int nTips = 5 + xPct * 60;
	int nStarPts = nTips * 2;
	float angleChangePerPt = TWO_PI / (float)nStarPts;
	float innerRadius = 0 + yPct*80;
	float outerRadius = 80;
	float origx = 525;
	float origy = 100;
	float angle = 0;
	
	ofSetColor(0xa16bca);
	ofBeginShape();
	for (int i = 0; i < nStarPts; i++){
		if (i % 2 == 0) {
			// inside point:
			float x = origx + innerRadius * cos(angle);
			float y = origy + innerRadius * sin(angle);
			ofVertex(x,y);
		} else {
			// outside point
			float x = origx + outerRadius * cos(angle);
			float y = origy + outerRadius * sin(angle);
			ofVertex(x,y);
		}
		angle += angleChangePerPt;
	}
	ofEndShape();
	//-------------------------------------
	
	//------(d)--------------------------------------
	// 
	// 		poylgon of random points
	//
	// 		lots of self intersection, 500 pts is a good stress test
	// 
	// 
	ofSetColor(0x0cb0b6);
	ofSetPolyMode(OF_POLY_WINDING_ODD);
	ofBeginShape();
	for (int i = 0; i < 10; i++){
		ofVertex(ofRandom(650,850), ofRandom(20,200));
	}
	ofEndShape();
	//-------------------------------------
	
	
	//------(e)--------------------------------------
	// 
	// 		use sin cos and time to make some spirally shape
	//
	glPushMatrix();
		glTranslatef(100,300,0);
		ofSetColor(0xff2220);
		ofFill();
		ofSetPolyMode(OF_POLY_WINDING_ODD);
		ofBeginShape();
		float angleStep 	= TWO_PI/(100.0f + sin(ofGetElapsedTimef()/5.0f) * 60); 
		float radiusAdder 	= 0.5f;
		float radius 		= 0;
		for (int i = 0; i < 200; i++){
			float anglef = (i) * angleStep;
			float x = radius * cos(anglef);
			float y = radius * sin(anglef); 
			ofVertex(x,y);
			radius 	+= radiusAdder; 
		}
		ofEndShape(OF_CLOSE);
	glPopMatrix();
	//-------------------------------------
	
	//------(f)--------------------------------------
	// 
	// 		ofCurveVertex
	// 
	// 		because it uses catmul rom splines, we need to repeat the first and last 
	// 		items so the curve actually goes through those points
	//

	ofSetColor(0x2bdbe6);
	ofBeginShape();
	
		for (int i = 0; i < nCurveVertexes; i++){
			
			
			// sorry about all the if/states here, but to do catmull rom curves
			// we need to duplicate the start and end points so the curve acutally 
			// goes through them.
			
			// for i == 0, we just call the vertex twice
			// for i == nCurveVertexes-1 (last point) we call vertex 0 twice
			// otherwise just normal ofCurveVertex call
			
			if (i == 0){
				ofCurveVertex(curveVertices[0].x, curveVertices[0].y); // we need to duplicate 0 for the curve to start at point 0
				ofCurveVertex(curveVertices[0].x, curveVertices[0].y); // we need to duplicate 0 for the curve to start at point 0
			} else if (i == nCurveVertexes-1){
				ofCurveVertex(curveVertices[i].x, curveVertices[i].y);
				ofCurveVertex(curveVertices[0].x, curveVertices[0].y);	// to draw a curve from pt 6 to pt 0
				ofCurveVertex(curveVertices[0].x, curveVertices[0].y);	// we duplicate the first point twice
			} else {
				ofCurveVertex(curveVertices[i].x, curveVertices[i].y);
			}
		}
		
	ofEndShape();
	
	
	// show a faint the non-curve version of the same polygon:
	ofEnableAlphaBlending();
		ofNoFill();
		ofSetColor(0,0,0,40);
		ofBeginShape();
			for (int i = 0; i < nCurveVertexes; i++){
				ofVertex(curveVertices[i].x, curveVertices[i].y);
			}
		ofEndShape(true);
		
		
		ofSetColor(0,0,0,80);
		for (int i = 0; i < nCurveVertexes; i++){
			if (curveVertices[i].bOver == true) ofFill();
			else ofNoFill();
			ofCircle(curveVertices[i].x, curveVertices[i].y,4);
		}
	ofDisableAlphaBlending();
	//-------------------------------------
	
	
	//------(g)--------------------------------------
	// 
	// 		ofBezierVertex
	// 
	// 		with ofBezierVertex we can draw a curve from the current vertex
	//		through the the next three vertexes we pass in.
	//		(two control points and the final bezier point)
	//		
	
	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;
	
	
	
	ofFill();
	ofSetColor(0xFF9933);
	ofBeginShape();
	ofVertex(x0,y0);
	ofBezierVertex(x1,y1,x2,y2,x3,y3);
	ofEndShape();
	
	
	ofEnableAlphaBlending();
		ofFill();
		ofSetColor(0,0,0,40);
		ofCircle(x0,y0,4);
		ofCircle(x1,y1,4);
		ofCircle(x2,y2,4);
		ofCircle(x3,y3,4);
	ofDisableAlphaBlending();
	
	
	
	//------(h)--------------------------------------
	// 
	// 		holes / ofNextContour
	// 
	// 		with ofNextContour we can create multi-contour shapes
	// 		this allows us to draw holes, for example... 
	//
	ofFill();
	ofSetColor(0xd3ffd3);
	ofRect(80,480,140,70);
	ofSetColor(0xff00ff);
	
	ofBeginShape();
		
		ofVertex(100,500);
		ofVertex(180,550);
		ofVertex(100,600);
		
		ofNextContour(true);
		
		ofVertex(120,520);
		ofVertex(160,550);
		ofVertex(120,580);
		
	ofEndShape(true);
	//-------------------------------------
	
	
	//------(i)--------------------------------------
	// 
	// 		CSG / ofNextContour
	// 
	// 		with different winding rules, you can even use ofNextContour to 
	// 		perform constructive solid geometry 
	// 		
	// 		be careful, the clockwiseness or counter clockwisenss of your multiple
	// 		contours matters with these winding rules.
	//
	// 		for csg ideas, see : http://glprogramming.com/red/chapter11.html
	// 
	// 		info about the winding rules is here:
	//		http://glprogramming.com/red/images/Image128.gif
	// 
	ofNoFill();
	
	
	glPushMatrix();
	
	ofSetPolyMode(OF_POLY_WINDING_ODD);
	
	ofBeginShape();
		
		ofVertex(300,500);
		ofVertex(380,550);
		ofVertex(300,600);
		
		ofNextContour(true);
		
		for (int i = 0; i < 20; i++){
			float anglef = ((float)i / 19.0f) * TWO_PI;
			float x = 340 + 30 * cos(anglef);
			float y = 550 + 30 * sin(anglef); 
			ofVertex(x,y);
			radius 	+= radiusAdder; 
		}
		

	ofEndShape(true);
	
	glTranslatef(100,0,0);
	
	ofSetPolyMode(OF_POLY_WINDING_NONZERO);	
	ofBeginShape();
		
		ofVertex(300,500);
		ofVertex(380,550);
		ofVertex(300,600);
		
		ofNextContour(true);
		
		for (int i = 0; i < 20; i++){
			float anglef = ((float)i / 19.0f) * TWO_PI;
			float x = 340 + 30 * cos(anglef);
			float y = 550 + 30 * sin(anglef); 
			ofVertex(x,y);
			radius 	+= radiusAdder; 
		}
		
	ofEndShape(true);
	
	glTranslatef(100,0,0);
	ofSetPolyMode(OF_POLY_WINDING_ABS_GEQ_TWO);
	ofBeginShape();
		ofVertex(300,500);
		ofVertex(380,550);
		ofVertex(300,600);
		ofNextContour(true);
		
		for (int i = 0; i < 20; i++){
			float anglef = ((float)i / 19.0f) * TWO_PI;
			float x = 340 + 30 * cos(anglef);
			float y = 550 + 30 * sin(anglef); 
			ofVertex(x,y);
			radius 	+= radiusAdder; 
		}
		
		
	ofEndShape(true);
	
	glPopMatrix();
	//-------------------------------------
	
	
	ofSetColor(0x000000);
	ofDrawBitmapString("(a) star\nwinding rule odd", 20,210);
	
	ofSetColor(0x000000);
	ofDrawBitmapString("(b) star\nwinding rule nonzero", 220,210);
	
	ofSetColor(0x000000);
	ofDrawBitmapString("(c) dynamically\ncreated shape", 420,210);
	
	ofSetColor(0x000000);
	ofDrawBitmapString("(d) random points\npoly", 670,210);
	
	ofSetColor(0x000000);
	ofDrawBitmapString("(e) fun with sin/cos", 20,410);
	
	ofSetColor(0x000000);
	ofDrawBitmapString("(f) ofCurveVertex\nuses catmull rom\nto make curved shapes", 220,410);
	
	ofSetColor(0x000000);
	ofDrawBitmapString("(g) ofBezierVertex\nuses bezier to draw curves", 460,410);
	
	
	ofSetColor(0x000000);
	ofDrawBitmapString("(h) ofNextContour\nallows for holes", 20,610);
	
	ofSetColor(0x000000);
	ofDrawBitmapString("(i) ofNextContour\ncan even be used for CSG operations\nsuch as union and intersection", 260,620);
	
	
}
//--------------------------------------------------------------
void testApp::draw(){
    ofBackground(0);
    
    float time = player.getPosition()*player.getLength();
    
    //  TIME LINE
    //
    player.draw();
    
    //  Current lineStroke
    //
    ofPushMatrix();
    ofSetColor(255,0,0,100);
    ofTranslate(0, ofGetHeight() - player.height);
    float strokeY = ofMap(lineStroke, 0.0,MAX_LINE_WIDTH, player.height*0.9-REFERENCEBOX_HEIGHT*0.5,player.height*0.1+REFERENCEBOX_HEIGHT*0.5);
    ofBeginShape();
    ofVertex(0, strokeY-MARK_SIZE);ofVertex(0, strokeY+MARK_SIZE);ofVertex(MARK_SIZE, strokeY);
    ofEndShape(false);
    ofLine(MARK_SIZE, strokeY, ofGetWidth(), strokeY);
    ofPopMatrix();
    
    //  LINES
    //
    ofEnableSmoothing();
    
    ofSetColor(255);
    actualLine.draw(time);
    
    ofSetColor(180);
    for (int i = 0; i < storedLines.size(); i++){
        
        storedLines[i].bSelected = false;
        
        if ( i == nSelected){
            ofSetColor(255,0,0);
            storedLines[i].bSelected = true;
        } else {
            ofSetColor(255);
        }
        
        storedLines[i].draw( time );
    }

    ofDisableSmoothing();
    
    //  Cursor
    //
    if (bCursor){
        ofPushMatrix();
        ofPushStyle();
        ofSetColor(255);
        ofSetLineWidth(0.1);
        
        if (bFlipped)
            ofTranslate(ofGetScreenWidth()-mouseX, mouseY);
        else
            ofTranslate(mouseX, mouseY);
        
        ofCircle(0, 0, 1);
        int size = 5;
        int margin = 3;
        ofLine(-margin, 0, -margin-size, 0);
        ofLine(margin, 0, margin+size, 0);
        ofLine(0, -margin, 0, -margin-size);
        ofLine(0, margin, 0, margin+size);
        ofPopStyle();
        ofPopMatrix();
    }
    
    ofSetColor(255,0,0,0);
	for (int i = 0; i < FFTanalyzer.nAverages; i++){
		ofRect(200+(i*20),600-FFTanalyzer.peaks[i] * 6,20,-4);
	}
}
//--------------------------------------------------------------
void testApp::draw(){    
    map.draw();
    
    ofPushStyle();

    ofSetColor(0,200,0);
    ofCircle( map.locationPoint(myLoc), map.getZoom() );
    
    ofSetColor(0,200,0,100);
    ofBeginShape();
    for(int i = 0; i < areaZone.size(); i++){
        ofVertex(areaZone[i]);
    }
    ofEndShape();
    
    for (int i = 0; i < citiesPos.size(); i++){
        
        if (areaZone.inside( citiesPos[i] )){
            ofSetColor(0,50,0,200);
            ofDrawBitmapString(dBase.getCity(i), citiesPos[i] + ofPoint(10,5));

            ofFill();
        } else {
            ofNoFill();
        }
        
        ofSetColor(150,0,0,200);
        ofCircle(citiesPos[i], map.getZoom() * 2);
        ofSetColor(200,0,0,200);
        ofCircle(citiesPos[i], map.getZoom());
        
        ofFill();
        ofSetColor(255,0,0,200);
        ofCircle(citiesPos[i], 2);
        
    }
    
    ofSetColor(0,180);
    ofFill();
    ofRect(graphView);
    
    ofPushMatrix();
    float pct = 0.7;
    ofRectangle white = graphView;
    white.width = graphView.width*pct;
    white.height = graphView.height * (1.0-PctImm);
    ofSetColor(255,50);
    ofRect(white);
    
    ofRectangle black = graphView;
    black.width = graphView.width*pct;
    black.y = white.y + white.height;
    black.height = graphView.height * PctBlack;
    ofSetColor(0,200,0,200);
    ofRect(black);
    ofSetColor(255);
    ofDrawBitmapString(ofToString( (int)(PctBlack*100) )+ "% african a.", black.x+5, black.y+15);
    
    ofRectangle latin = graphView;
    latin.width = graphView.width*pct;
    latin.y = black.y + black.height;
    latin.height = graphView.height * PctLatino;
    ofSetColor(0,150,0,200);
    ofRect(latin);
    ofSetColor(255);
    ofDrawBitmapString(ofToString( (int)(PctLatino*100) )+ "% latin", latin.x+5, latin.y+15);
    
    ofRectangle asian = graphView;
    asian.width = graphView.width*pct;
    asian.y = latin.y + latin.height;
    asian.height = graphView.height * PctAsian;
    ofSetColor(0,100,0,200);
    ofRect(asian);
    ofSetColor(255);
    ofDrawBitmapString(ofToString( (int)(PctAsian*100) )+ "% asian", asian.x+5, asian.y+15);

    ofRectangle unEmp = graphView;
    unEmp.width = graphView.width*(1.0-pct);
    unEmp.x += graphView.width*pct;
    unEmp.height = graphView.height * PctUnEmploy;
    ofSetColor(255,50);
    ofRect(unEmp);
    
    ofRectangle emp = graphView;
    emp.width = graphView.width*(1.0-pct);
    emp.x += graphView.width*pct;
    emp.y = unEmp.y + unEmp.height;
    emp.height = graphView.height * (1.0-PctUnEmploy);
    ofSetColor(0,50,0,200);
    ofRect(emp);
    
    ofSetColor(255);
    ofDrawBitmapString(ofToString( (int)(PctUnEmploy*100)) + "%", unEmp.x+5, unEmp.y+15 );
    ofDrawBitmapString("unEmp", unEmp.x+5, unEmp.y+30);
    
    ofPopMatrix();
    
    ofPopStyle();

}