Example #1
0
//------------------------------------------------------------------
void creature::draw() {
    
    ofPushMatrix();
    ofTranslate(pos.x, pos.y, 0);
    ofRotateZ(angle * RAD_TO_DEG);
    ofBeginShape();
    for (int i = 0; i < 100; i++){
        ofSetColor(ofRandom(255),ofRandom(255),ofRandom(255));
        float add = ofNoise(i/10.0f, ofGetElapsedTimef() * 3 * (float)ofGetMouseX() / (float)ofGetWidth());
        
        ofVertex( (50 + 100 * add) * cos((i / 100.0) * TWO_PI),
                 (50 + 100 * add) * sin((i / 100.0) * TWO_PI));
    }
    ofEndShape();
    ofPopMatrix();
    
    ofPushMatrix();
    ofTranslate(pos.x + 150, pos.y + 150, 0);
    ofRotateZ(angle * RAD_TO_DEG);
    ofBeginShape();
    for (int i = 0; i < 100; i++){
        ofSetColor(ofRandom(255),ofRandom(255),255);
        float add = ofNoise(i/15.0f, ofGetElapsedTimef() * 3 * (float)ofGetMouseY()/ (float)ofGetWidth());
        
        ofVertex(	(50 * add) * cos((i / 100.0) * TWO_PI),
                 (50 * add) * sin((i / 100.0) * TWO_PI));
    }
    ofEndShape();
    ofPopMatrix();
    
    ofPushMatrix();
    ofTranslate(pos.x + 150, pos.y + 50, 0);
    ofRotateZ(angle * RAD_TO_DEG);
    ofBeginShape();
    for (int i = 0; i < 100; i++){
        ofSetColor(ofRandom(255),255,ofRandom(255));
        float add = ofNoise(i/30.0f, ofGetElapsedTimef() * 3 * (float)ofGetMouseY()/ (float)ofGetWidth());
        
        ofVertex(	(20 * add) * cos((i / 100.0) * TWO_PI),
                 (20 * add) * sin((i / 100.0) * TWO_PI));
    }
    ofEndShape();
    ofPopMatrix();
    
}
Example #2
0
//--------------------------------------------------------------
void ofApp::drawRectByVertex(float x, float y, float kwan, float gao){
    //draw the square vertex by vertex
    ofBeginShape();
    ofVertex(x, y);
    ofVertex(x + kwan, y);
    ofVertex(x + kwan, y + gao);
    ofVertex(x, y + gao);
    ofEndShape();
}
Example #3
0
//------------------------------------------------------------
void particle::draw(){
    
	
	ofNoFill();
    ofSetColor(80);
//	ofCircle(pos.x, pos.y, 3);
	
	ofPoint velNormal = vel;
	velNormal.normalize();
	
	ofPoint velPerp;
	velPerp.x = -velNormal.y;
	velPerp.y = velNormal.x;
	
//	ofLine(pos.x, pos.y, pos.x + velNormal.x*10, pos.y + velNormal.y*10);
    
    
    float dx = pos.x - prevPos.x;
    float dy = pos.y - prevPos.y;
    
    angle = atan2(dy, dx);
    float diff;
    int clampMax = 100;
    
//    if (dx<100 && dy < 100) diff = (ofDist(0, 0, dx, dy))*5;
    diff = ofDist(0,0, vel.x, vel.y)*10;
    
    ofClamp(diff, 0, 100);
    size = diff * 0.1 + size * 0.9;
    
    prevPos.x = pos.x;
    prevPos.y = pos.y;
    
    ofEnableAlphaBlending();
    ofSetColor(c,150);
    ofFill();
    ofSetCircleResolution(3);
    ofPushMatrix();
    ofTranslate(pos.x, pos.y);
    ofRotateZ((angle * RAD_TO_DEG)+30);
    ofScale(size, size);
    
    
//    ofCircle(0, 0, size);
    ofBeginShape();
    ofVertex(r1*0, r1*1);
    ofVertex(r2*cos(60), r2*sin(60));
    ofVertex(r3*cos(150), r3*sin(150));
    ofEndShape();
    
    
    
    ofPopMatrix();
    ofSetCircleResolution(60);
    ofDisableAlphaBlending();
	   
}
//--------------------------------------------------------------
void MovingLine::display(){
	ofBeginShape();
	ofCurveVertex(ptrOfApp->minX, vertices[0].y);
	for(int i = 0; i < vertices.size(); i++){
		ofCurveVertex(vertices[i].x, vertices[i].y);
	}
	ofCurveVertex(ptrOfApp->maxX, vertices.back().y);
	ofEndShape();
}
Example #5
0
void ofxShapes :: drawShape( ofxShapesItem *shape )
{
	ofBeginShape();
	for( int i=0; i<shape->vertices.size(); i++ )
	{
		ofVertex( shape->vertices[ i ][ 0 ], shape->vertices[ i ][ 1 ] );
	}
	ofEndShape( false );
}
Example #6
0
//--------------------------------------------------------------
void testApp::draw(){
    ofSetColor(ofColor::white);
    image.draw(0,0);
    ofSetColor(255, 255, 0, 100);
    ofBeginShape();
    ofFill();
    ofVertexes(pointsConvex.getVertices());
    ofEndShape();
}
Example #7
0
void drawPoly(vector<ofVec2f> &poly) {

    ofBeginShape();
    for(int i = 0; i < poly.size(); i++) {
        //mesh.addVertex(poly[i]);
        ofVertex(poly[i].x, poly[i].y);
    }
    ofEndShape();
}
Example #8
0
void Print::draw()
{
    ofSetColor(255);
    //bg1.resize(ofGetWidth(), 330);
    //bg2.resize(ofGetWidth(), 470);
    //reciept.resize(180, 200+pos.val());

    ofEnableAlphaBlending();
    bg2.draw(0, 800);
    reciept.draw(350, 350+2*pos.val());
    bg1.draw(0,0);
    ofDisableAlphaBlending();
    
 
    // Flight Animation
    ofSetColor(255, 102, 102);
    if(pp.y < ofGetHeight())
    {
        pp.y += vel;
        ofBeginShape();
        ofVertex(0, ofGetHeight());
        ofVertex(0,0);
        ofVertex(pp.x, pp.y);
        ofVertex(ofGetWidth(),0);
        ofVertex(ofGetWidth(), ofGetHeight());
        ofEndShape();
        
        // 飛行機
        ofSetColor(255);
        ofEnableAlphaBlending();
        flight.draw(ofGetWidth()/2-60, pp.y);
        ofDisableAlphaBlending();
    }else{
        width_x+=7;
        pp.y += vel;
        ofBeginShape();
        ofVertex(0, ofGetHeight());
        ofVertex(-width_x,0);
        ofVertex(pp.x, pp.y);
        ofVertex(ofGetWidth()+width_x,0);
        ofVertex(ofGetWidth(), ofGetHeight());
        ofEndShape();
    }
}
//--------------------------------------------------------------
void testApp::draw(){

     ofSetHexColor(0x000000);
     ofNoFill();
     ofBeginShape();
     for (int i = 0; i < nPts; i++){
         ofVertex(pts[i].x, pts[i].y);
     }
     ofEndShape();

     string info = "speed of rotation (a/z): " + ofToString(speedOfRotation,3) + "\n" +
                  "rotateAmount in x (s/x): " + ofToString(rotateAmount.x,3) + "\n" +
                  "rotateAmount in y (d/c): " + ofToString(rotateAmount.y,3) + "\n" +
                  "rotateAmount in z (f/v): " + ofToString(rotateAmount.z,3);

     ofFill();
     ofSetHexColor(0xE5A93F);
     ofRect(10,10,300,70);
     ofSetHexColor(0x000000);
     ofDrawBitmapString(info,30,30);


     ofSetColor(50,50,255);
     ofNoFill();
     ofBeginShape();
        ofVertex(xAxisMin.x, xAxisMin.y, xAxisMin.z);
        ofVertex(xAxisMax.x, xAxisMax.y, xAxisMax.z);
     ofEndShape();
     ofBeginShape();
        ofVertex(yAxisMin.x, yAxisMin.y, yAxisMin.z);
        ofVertex(yAxisMax.x, yAxisMax.y, yAxisMax.z);
     ofEndShape();
     ofBeginShape();
        ofVertex(zAxisMin.x, zAxisMin.y, zAxisMin.z);
        ofVertex(zAxisMax.x, zAxisMax.y, zAxisMax.z);
     ofEndShape();


    if (bDrawnAnything == false){
        ofSetColor(0,0,0);
        ofDrawBitmapString("draw something!", ofGetWidth()/2 + 100,ofGetHeight()/2 + 20);
    }

}
Example #10
0
void ofApp::drawAudioInput(float x, float y, float scale) {
	scale /= 4;
	int resolution = MAX(audioBuffersize / scale, 1);
	
	ofPushStyle();
	
	ofPushMatrix();
	ofTranslate(x + scale, y + scale);
	ofScale(scale, scale);
	
	ofNoFill();
	ofSetColor(255);
	ofRect(-1, -1, 2, 2);
	ofBeginShape();
	for(int i = 0; i < audioBuffersize; i += resolution) {
		ofVertex(frontAudioBuffer[i * 2], frontAudioBuffer[i * 2 + 1]);
	}
	ofEndShape();
	
	ofPushMatrix();
	ofSetColor(magentaPrint);
	ofTranslate(1, 0);
	ofScale(2. / audioBuffersize, 1);
	ofBeginShape();
	for(int i = 0; i < audioBuffersize; i += resolution) {
		ofVertex(i, frontAudioBuffer[i * 2]);
	}
	ofEndShape();
	ofPopMatrix();
	
	ofPushMatrix();
	ofSetColor(cyanPrint);
	ofTranslate(0, 1);
	ofScale(1, 2. / audioBuffersize);
	ofBeginShape();
	for(int i = 0; i < audioBuffersize; i += resolution) {
		ofVertex(frontAudioBuffer[i * 2 + 1], i);
	}
	ofEndShape();
	ofPopMatrix();
	
	ofPopMatrix();
	ofPopStyle();
}
Example #11
0
void ofApp::drawShape() {
    ofBeginShape();
    for(int i = 1; i < numPoints; i++) {
        ofVertex(points[i-1]->screenX(), points[i-1]->screenY());
        ofVertex(points[i]->screenX(), points[i]->screenY());
    }
    ofVertex(points[numPoints - 1]->screenX(), points[numPoints - 1]->screenY());
    ofVertex(points[0]->screenX(), points[0]->screenY());
    ofEndShape();
}
Example #12
0
void Tile::fill() const
{
    ofFill();
    ofBeginShape();
    for (auto& pt : vertices) {
        ofVertex(pt.x, pt.y);
    }
    ofEndShape();
    ofNoFill();
}
Example #13
0
void SpringStroke::drawSurface()
{
    vector<Particle*> pars = line->getPoints();
    ofBeginShape();
    for (int i=0; i<pars.size(); i++)
    {
        ofVertex(pars[i]->x, pars[i]->y);
    }
    ofEndShape();
}
void FboMaskShape::drawShape(){
	ofBeginShape();
	int max = points.size();
	for(int i = 0; i < max; ++i){
		ofxVec2f& point = points[i];
		ofVertex(point.x, point.y);
	}
	
	ofEndShape(true);
}
Example #15
0
//--------------------------------------------------------------
void testApp::draw()
{
    ofBackground(255);
    
    if (dragPtsLeft.size() >0) {
        ofNoFill();
        ofSetLineWidth(1);
        ofSetColor(0);
        ofBeginShape();
        for (int i = 0; i < dragPtsLeft.size(); i++) {
            ofVertex(dragPtsLeft[i].x, dragPtsLeft[i].y,0);
            ofSetColor(255, 0, 0);
            ofCircle(dragPtsLeft[i].x, dragPtsLeft[i].y,5);
        }
        ofEndShape(true);
    }
    
    
    if (dragPtsRight.size() >0) {
        ofNoFill();
        ofSetLineWidth(1);
        ofSetColor(0);
        ofBeginShape();
        for (int i = 0; i < dragPtsRight.size(); i++) {
            ofVertex(dragPtsRight[i].x, dragPtsRight[i].y,0);
            ofSetColor(0,255,0);
            ofCircle(dragPtsRight[i].x, dragPtsRight[i].y,5);
        }
        ofEndShape(true);
    }
    
    ofSetColor(0, 0, 0);
    ofFill();
    ofRect(0, ofGetHeight()-70, ofGetWidth(), 70);
    ofSetColor(255);
    stringstream s;
    s << "Click in window to start making points. Use Left and Right Clicks." << endl;
    s << "Number of Points Left " + ofToString(dragPtsLeft.size()) + "   Number of Points Right " + ofToString(dragPtsRight.size()) << endl;
    s << "Click 'r' to reset points" << endl;
    s << "Click 'w' to write points to File" <<endl;
    
    ofDrawBitmapString(s.str(), 10,ofGetHeight()-50);
}
void scrollingGraph::draw(float height) {
    ofNoFill();
    ofBeginShape();
    for (unsigned int j = 0; j < valHistory.size(); j++){
        float valNormalized = ofMap(valHistory[j], minVal, maxVal, 0.0, 1.0);
        ofVertex(j + 100, height - valNormalized * height);
    }
    ofEndShape(false);
    ofFill();
}
Example #17
0
void defense::ArrowsDraw(){
    
    ofRectangle RectOut;
    RectOut = OneBigRect();
    ofSetColor(0, 0, 0 );
    Fuentes[1].drawString("Example 1. The gradient of an image",
                          RectOut.x,RectOut.y + RectOut.height*.1);
    ofRectangle RectLimits;
    
    RectLimits.x =(RectOut.getCenter()).x - 1.5*RectOut.width/4.0;
    RectLimits.y=(RectOut.getCenter()).y - 1.2*RectOut.height/4.0;
    RectLimits.width=RectOut.width/2.0;
    RectLimits.height=RectOut.height/2.0;
    glPushMatrix();
    
    ofTranslate(RectLimits.x, RectLimits.y);
    ofScale(1.5*RectLimits.width/Nx,1.5*RectLimits.height/Ny);
    short SX,SY;
    ofSetColor(0, 0, 0 );
    for (int k=0;k<MeshX;k+=2) {
        for (int q=0; q < MeshY; q+=2) {
            //lines
            
            SX = ((short*)(G_Gx->imageData + (Ny/MeshY)*G_Gx->widthStep*q))[(Nx/MeshX)*k];
            SY = ((short*)(G_Gy->imageData + (Ny/MeshY)*G_Gy->widthStep*q))[(Nx/MeshX)*k];
            
            ofLine(G_posX[k][q], G_posY[k][q], 
                 G_posX[k][q] - (.2)*(float)SX, G_posY[k][q]- (.2)*(float)SY);
//            // arrows
            float tipX = G_posX[k][q]-(.2)*(float)SX;
            float tipY = G_posY[k][q]-(.2)*(float)SY;
            float f = tan(PI/9.0)*sqrt((.2)*(float)SX*(.2)*(float)SX+
                                       (.2)*(float)SY*(.2)*(float)SY)/5.0;
            float alfa = atan2((.2)*(float)SY, (.2)*(float)SX); 
            ofFill();
            ofBeginShape();
            ofVertex(tipX, tipY);
            ofVertex(tipX+(.2)*(float)SX/5.0+f*sin(alfa), 
                   tipY+(.2)*(float)SY/5.0 - f*cos(alfa));
            ofVertex(tipX+(.2)*(float)SX/5.0-f*sin(alfa), 
                   tipY+(.2)*(float)SY/5.0 + f*cos(alfa));
            ofEndShape(true);
        }
    }
    
    
    
    
    
    
    
    glPopMatrix();
    
    
}
Example #18
0
//----------------------------------------------------------						
void ofxVectorGraphics::endShape(bool bClose){
	if(bDraw){
		ofEndShape(bClose);
	}
	if(bRecord){
											
		//catmull roms - we need at least 4 points to draw
		if( whichShapeMode == 1 && curvePts.size() > 3){												
			
			//we go through and we calculate the bezier of each 
			//catmull rom curve - smart right? :)
			for (int i = 1; i< curvePts.size()-2; i++) {
				
				ofPoint3 prevPt(	curvePts[i-1][0],	curvePts[i-1][1]);
				ofPoint3 startPt(curvePts[i][0],		curvePts[i][1]);							
				ofPoint3 endPt(	curvePts[i+1][0],	curvePts[i+1][1]);
				ofPoint3 nextPt(	curvePts[i+2][0],	curvePts[i+2][1]);
				
				//SUPER WEIRD MAGIC CONSTANT = 1/6
				//Someone please explain this!!! 
				//It works and is 100% accurate but wtf!
				ofPoint3 cp1 = startPt + ( endPt - prevPt ) * (1.0/6);
				ofPoint3 cp2 = endPt + ( startPt - nextPt ) * (1.0/6);						
				
				//if this is the first line we are drawing 
				//we have to start the path at a location
				if( i == 1 ){
					creeps.startPath(startPt.x, startPt.y);
					bShouldClose = true;
				}
				
				creeps.addCurve( cp1.x, cp1.y, cp2.x, cp2.y, endPt.x, endPt.y);
			}						
		}
		
		if(bShouldClose){														
			//we close the path if requested
			if(bClose)creeps.closeSubpath();
		
			//render the stroke as either a fill or a stroke.
			if(bFill){
				creeps.endPath(CreEPS::FILL);
			}else{
				creeps.endPath(CreEPS::STROKE);
			}
			bShouldClose = false;
		}
		
		//we want to clear all the vertices
		//otherwise we keep adding points from
		//the previous file - cool but not what we want!
		clearAllVertices();
		
	}
}			
//--------------------------------------------------------------
void testApp::draw() {


    ofSetColor(0,0,0);
    ofNoFill();
    ofBeginShape();
    for (int i = 0; i < pts.size(); i++) {
        ofVertex(pts[i].x, pts[i].y);
    }
    ofEndShape();
}
//--------------------------------------------------------------
void AudioAnalyzer::draw() {

    int plotHeight = 128;

    //ofEnableAlphaBlending();

    ofSetColor(0xffffff);
    ofPushMatrix();

    glTranslatef(panel. boundingBox.x,panel.boundingBox.y+10,0);//16, 16, 0);
    ofDrawBitmapString("Audio Input", 0, 0);
    plot(audioInput, bufferSize, plotHeight / 2, 0);

    glTranslatef(0, plotHeight + 16, 0);
    ofDrawBitmapString("FFT Output", 0, 0);
    plot(fftOutput, fft->getBinSize(), -plotHeight, plotHeight / 2);


    ofSetColor(255,0,0,200);
    //ofLine(0,-averageVal*plotHeight+plotHeight,fft->getBinSize(),-averageVal*plotHeight+plotHeight);
    ofSetColor(255,255,255,255);

    ofPushMatrix();
    glTranslatef(fft->getBinSize(), 0, 0);
    ofDrawBitmapString("EQd FFT Output", 0, 0);
    plotPeaks(fft->getBinSize(), -plotHeight, plotHeight / 2);//plot(avgBands, numAvgBands-1,-plotHeight, plotHeight / 2);
    plot(eqOutput, fft->getBinSize(), -plotHeight, plotHeight / 2);

    glPushMatrix();
    glTranslatef(0, plotHeight / 2 + (plotHeight / 2), 0);
    ofBeginShape();
    for (int i = 0; i < numAvgBands; i++)
        ofVertex(i * 2, avgBands[i] * (-plotHeight));
    ofEndShape();
    glPopMatrix();

    ofPopMatrix();

    glTranslatef(0, plotHeight + 16, 0);
    ofDrawBitmapString("IFFT Output", 0, 0);
    plot(ifftOutput, fft->getSignalSize(), plotHeight / 2, 0);

    glTranslatef(0, plotHeight + 16, 0);
    ofDrawBitmapString("Blend FFT Output", 0, 0);
    plot(blendfft, fft->getSignalSize(), plotHeight / 2, 0);


    ofPopMatrix();

    //ofDrawBitmapString( "pitch is : " + ofToString((int)aubio.pitch) + "\namplitude is : " + ofToString(aubio.amplitude,3), 10,600);

    //stats_pitch.draw(16,460,100,100,10);

}
Example #21
0
//--------------------------------------------------------------
void testApp::draw(){

	ofBeginShape();

	for (int i = 0; i < points.size(); i++) {
		ofVertex(points[i].x, points[i].y, points[i].z);
	}
	
	ofEndShape();
	
}
Example #22
0
void testApp::plot(float* array, int length, float scale, float offset) {
    ofNoFill();
    ofRect(0, 0, length, plotHeight);
    glPushMatrix();
    glTranslatef(0, plotHeight / 2 + offset, 0);
    ofBeginShape();
    for (int i = 0; i < length; i++)
        ofVertex(i, array[i] * scale);
    ofEndShape();
    glPopMatrix();
}
//-------------------------------------------------
void timePointRecorder::draw(){
	
	ofSetColor(255);
	ofNoFill();
    ofSetLineWidth(1.5);
	ofBeginShape();
	for (int i = 0; i < pts.size();i++){
		ofCurveVertex(pts[i].x, pts[i].y);
	}
	ofEndShape();	
}
Example #24
0
void Subdivision::drawDiamond()
{
    ofSetColor(*color);
    ofFill();
    ofBeginShape();
        ofVertex(x, y+height/2);
        ofVertex(x+width/2, y);
        ofVertex(x+width, y+height/2);
        ofVertex(x+width/2, y+height);
    ofEndShape();
    ofNoFill();
    ofSetColor(0);
    ofSetLineWidth(1);
    ofBeginShape();
        ofVertex(x, y+height/2);
        ofVertex(x+width/2, y);
        ofVertex(x+width, y+height/2);
        ofVertex(x+width/2, y+height);
    ofEndShape();
}
Example #25
0
void Bubble::draw(){
    ofSetColor(color);
    if (mouseOver == true) { ofSetColor(mouseOverColor);}
    ofBeginShape();
    ofEllipse(xPos, yPos, width, height);
    ofEndShape();
//    ofPopMatrix();
    
    //    cout << xPos << "," << yPos << "..." << xPosLeft << "," << yPosLeft << "..." << xPosRight << "," << yPosLeft << endl;
    
}
void ofxARToolkitPlus::draw(int x, int y, int w, int h) {
	
	float scaleX = (float)w / width;
	float scaleY = (float)h / height;
	
	glPushMatrix();
	glTranslatef(x, y, 0);
	glScalef(scaleX, scaleY, 1);
	ofSetLineWidth(1);
	
	int numDetected = tracker->getNumDetectedMarkers();
	
	for(int i=0; i<numDetected; i++) {
		
		ARToolKitPlus::ARMarkerInfo marker = tracker->getDetectedMarker(i);
		
		// Draw the center point
		ofFill();
		ofSetColor(255, 0, 255 );
		ofDrawRectangle(marker.pos[0]-1, marker.pos[1]-1, 2, 2);
		
		// Draw the inner rectangle
		ofNoFill();
		ofSetColor(255, 255, 0 );		
		ofBeginShape();
		ofVertex(marker.vertex[0][0], marker.vertex[0][1]);
		ofVertex(marker.vertex[1][0], marker.vertex[1][1]);
		ofVertex(marker.vertex[2][0], marker.vertex[2][1]);
		ofVertex(marker.vertex[3][0], marker.vertex[3][1]);
		ofEndShape(true);
		
		// Draw the marker ID
		ofSetColor( 255, 255, 255 );	
		ofDrawBitmapString(ofToString(marker.id), marker.pos[0], marker.pos[1]);
		
		// Draw the outer rectangle
//		ofPoint center(marker.pos[0], marker.pos[1]);
//		ofNoFill();
//		ofSetColor(255, 0, 0 );		
//		ofBeginShape();
//		for (int j=0; j<4; j++) {
//			ofPoint corner(marker.vertex[j][0], marker.vertex[j][1]);
//			corner -= center;
//			corner *= BORDER_SCALE;
//			corner += center;
//			ofVertex(corner.x, corner.y);
//		}
//		ofEndShape(true);
		
	}
	
	glPopMatrix();
	
}
void Line::draw(){
    cout << "draw" <<endl;
    ofNoFill();
    ofSetColor(0,0,0);
    ofBeginShape();
    ofSetLineWidth(width);
    ofVertex(posBeg.x, posBeg.y);
    ofVertex(posEnd.x, posEnd.y);
    
    ofEndShape();
}
Example #28
0
//--------------------------------------------------------------
void ofApp::drawDiamond(float centerX, float centerY, float kwan, float gao){

    ofBeginShape();
    ofVertex(centerX, centerY - gao/2);
    ofVertex(centerX+ kwan/3, centerY - gao/3);
    ofVertex(centerX + kwan/2, centerY);
    ofVertex(centerX, centerY + gao/2);
    ofVertex(centerX - kwan/2, centerY);
    ofVertex(centerX, centerY - gao/2);
    ofEndShape();
}
//--------------------------------------------------------------
void ModuleImageAnalyzer::drawHistogram(vector<float> & h) {
    ofBeginShape();
    ofNoFill();
    ofSetLineWidth(3);
    for (int i=0; i<h.size(); i++) {
        float x = ofMap(i, 0, h.size(), 0, 320);
        float y = ofMap(h[i], 0, 0.3, 240, 0);
        ofVertex(x, y);
    }
    ofEndShape();
}
Example #30
0
// declare methods/getters/setters
void MyPoly::draw() {
    ofSetColor(200, 100, 200);
    ofFill();
    ofBeginShape();
    for(int i=0; i<pointCount; ++i){
        ofVertex(vecs[i].x, vecs[i].y);
    }
    ofEndShape();
    
    
}