void testApp :: drawShape ( Shape& shape ) { ofBeginShape(); for( int i=0; i<shape.polyPoints.size(); i++ ) { ofPoint& p1 = shape.polyPoints.at( i ); ofVertex( p1.x, p1.y ); } ofEndShape( true ); }
//-------------------------------------------------------------- void testApp::draw(){ ofBackground(0); ofSetHexColor(0xffffff); bikers.draw(0, 0); quad1.beginDraw(); bikers.draw(0, 0); quad1.endDraw(); quad1.drawInputConfig(); quad1.drawOutputConfig(); fingerMovie.draw(510, 0); quad2.beginDraw(); fingerMovie.draw(510, 0); quad2.endDraw(); quad2.drawInputConfig(); quad2.drawOutputConfig(); ofSetHexColor(0x0cb0b6); ofSetPolyMode(OF_POLY_WINDING_ODD); ofBeginShape(); for (int i = 0; i < 10; i++){ ofVertex(ofRandom(850,1050), ofRandom(20,200)); } ofEndShape(); quad3.beginDraw(); ofBeginShape(); for (int i = 0; i < 10; i++){ ofVertex(ofRandom(850,1050), ofRandom(20,200)); } ofEndShape(); quad3.endDraw(); quad3.drawInputConfig(); quad3.drawOutputConfig(); }
void mui::Helpers::roundedRect(float x, float y, float w, float h, float r){ ofBeginShape(); ofVertex(x+r, y); ofVertex(x+w-r, y); quadraticBezierVertex(x+w, y, x+w, y+r, x+w-r, y); ofVertex(x+w, y+h-r); quadraticBezierVertex(x+w, y+h, x+w-r, y+h, x+w, y+h-r); ofVertex(x+r, y+h); quadraticBezierVertex(x, y+h, x, y+h-r, x+r, y+h); ofVertex(x, y+r); quadraticBezierVertex(x, y, x+r, y, x, y+r); ofEndShape(); }
void Contour::draw() { ofPushStyle(); ofNoFill(); ofSetLineWidth(2); ofSetColor(color); ofBeginShape(); for (int j=0; j<points.size(); j++) { ofVertex(points[j].x, points[j].y); } ofEndShape(); ofPopStyle(); }
void testApp::draw() { float audioHeight = ofGetHeight()/2.0f; float phaseDiff = ofGetWidth()/float(bufSize); ofSetColor(0,0,255); //波形を描く色 ofNoFill(); //塗り潰しをしない ofSetLineWidth(2); //線の太さを2pixで //左チャンネル波形を描画 ofBeginShape(); for (int i = 0; i < bufSize; i++) { ofVertex(i * phaseDiff, audioHeight/2 + lAudio[i] * audioHeight); } ofEndShape(); //右チャンネル波形を描画 ofBeginShape(); for (int i = 0; i < bufSize; i++) { ofVertex(i * phaseDiff, audioHeight / 2 * 3 + rAudio[i] * audioHeight); } ofEndShape(); }
void testApp::plot(vector<float>& buffer, float scale, float offset) { ofNoFill(); int n = buffer.size(); ofRect(0, 0, n, plotHeight); glPushMatrix(); glTranslatef(0, plotHeight / 2 + offset, 0); ofBeginShape(); for (int i = 0; i < n; i++) { ofVertex(i, buffer[i] * scale); } ofEndShape(); glPopMatrix(); }
void insect::draw(){ ofPushMatrix(); ofTranslate(posX, posY, posZ+ISize/3); // where to go ofRotateZ(sin((posX+posY)/2)*10); // looks like moving, used posX and posY, instead of random no. ofSetColor(0); ofFill(); ofCircle(0,0,ISize); //body ofNoFill(); //first leg (each leg lenth is same as the width of body of insect ofBeginShape(); ofVertex(0, -ISize/2, 0); ofVertex(0, -ISize, ISize/2+a1); // middle point, up half ofVertex(0, -ISize*3/2, -ISize/3+a1); ofEndShape(); //2nd leg ofBeginShape(); ofVertex(ISize/2, 0, 0); ofVertex(ISize, 0, ISize/2+a2); ofVertex(ISize*3/2, 0, -ISize/3+a2); ofEndShape(); //3rd leg ofBeginShape(); ofVertex(0, ISize/2, 0); ofVertex(0, ISize, ISize/2+a1); ofVertex(0, ISize*3/2, -ISize/3+a1); ofEndShape(); //4th leg ofBeginShape(); ofVertex(-ISize/2, 0, 0); ofVertex(-ISize, 0, ISize/2+a2); ofVertex(-ISize*3/2, 0, -ISize/3+a2); ofEndShape(); ofPopMatrix(); }
//-------------------------------------------------------------- void testApp::draw(){ ofBackground(0, 0, 0); //3- ofBeginShape(); for(int i=0; i<points.size(); i++){ // ofVertex(points[i]); ofCircle(points[i], 5);// one on top of another } ofEndShape(); }
void Radar::debug_draw_bezier_segments() { ofNoFill(); ofBeginShape(); { for (int i = 0; i < bezier_segments.size(); i++) { bezier b = bezier_segments[i]; if (i == 0) ofVertex(b.start); ofBezierVertex(b.c1, b.c2, b.end); } } ofEndShape(); }
//-------------------------------------------------------------- void testApp::draw(){ float xoff = t; ofNoFill(); ofSetColor(0); ofBeginShape(); for (int i = 0; i < ofGetWidth(); i++) { float y = ofNoise(xoff)*ofGetHeight(); xoff += 0.01; ofVertex(i,y); } ofEndShape(); t+= 0.01; }
void Particle::draw(){ ofFill(); // ofSetColor(66, 131, 252, 100); // drawArrowHead(vel, loc, 10); ofNoFill(); // ofSetColor(66, 131, 252, 100); ofBeginShape(); for(int i = 0; i < counter; i++){ ofVertex(hist[i].x, hist[i].y); } if(counter > 0) ofVertex(loc.x, loc.y); ofEndShape(false); }
void polyEditable::draw(bool bDrawClosed) { //polySimple::draw(); ofBeginShape(); for( int i = 0; i < pts.size(); i++) { ofVertex(pts[i].x,pts[i].y); } ofEndShape(bDrawClosed); if( mode == POLY_EDIT_MODE_MOVE_ALL) { //ofRectangle boundingBox = getBoundingBox(); //ofRect( boundingBox.x, boundingBox.y, boundingBox.width, boundingBox.height); } //if( mode == POLY_EDIT_MODE_MOVE_PTS ) //{ //-- draw selected point if( selectedPoint >= 0 ) { ofNoFill(); if(pts.size() > selectedPoint) ofCircle(pts[selectedPoint].x, pts[selectedPoint].y, 4); if(mode == POLY_EDIT_MODE_MOVE_PTS ) { ofFill(); ofSetColor(255, 255, 255,255); if(pts.size() > selectedPoint) ofCircle(pts[selectedPoint].x, pts[selectedPoint].y, 1); ofNoFill(); ofSetColor(255, 0, 0,0); if(pts.size() > selectedPoint) ofCircle(pts[selectedPoint].x, pts[selectedPoint].y, 1); } /*if(mode == POLY_EDIT_MODE_MOVE_PTS ) { ofNoFill(); ofSetColor(100,100,100,200); for( int i = 0; i < pts.size(); i++) { if( i != selectedPoint) ofCircle(pts[i].x, pts[i].y, 4); } }*/ } //}else }
//-------------------------------------------------------------- void ofApp::draw() { ofPushMatrix(); ofTranslate(0,height/2); ofSetLineWidth(4); // ofSetColor(255,255,255,96*averageVol); if (tracker.getAccuracy() < 0.5) ofSetColor(0,255,0,96*averageVol); else if (tracker.getAccuracy() < 1) ofSetColor(255,255,0,96*averageVol); else if (tracker.getAccuracy() < 3) ofSetColor(255,0,0,96*averageVol); else ofSetColor(255,255,255,96*averageVol); ofFill(); ofBeginShape(); for (unsigned int i=0; i < curveVertecies.size(); i++) ofCurveVertex(i*width/curveVertecies.size(), curveVertecies[i]*96); for (unsigned int i=curveVertecies.size()-1; i > 3; i-= 4) ofCurveVertex(i*width/curveVertecies.size(), curveVertecies[i]*32); ofCurveVertex(0,0); ofEndShape(true); ofPopMatrix(); level.draw(metronome); tracker.draw(level.getTarget(), averageFreq); ofSetColor(255,255,0,(int) 128 * (count[2]/10.) ); ofNoFill(); // ofLine(ofGetWidth()/3,0,ofGetWidth()/3,ofGetHeight()); ofRect(2,2,width-4,height-4); // Counter ofFill(); ofSetCircleResolution(32); for (int i=0; i < metronome.getUpper(); i++) { if (i+1 == count[0]) { ofSetColor(255,0,0); ofCircle(24 + 16*i,height-24,6); } else { ofSetColor(255,0,0,128); ofCircle(24 + 16*i,height-24,3); } } ofSetColor(128); ofDrawBitmapString("volume: " + ofToString(averageVol*100., 3), width-164, height-40); ofDrawBitmapString("Frequency: " + notelookup.lookup(averageFreq) + " " + ofToString(averageFreq, 0) + "Hz", width-256, height-20); ofDrawBitmapString("BPM: " + ofToString(metronome.getBPM(), 0), width/2 - 40, 12); }
void ofApp::drawHI(float xPos, float yPos, float scale){ ofPushMatrix(); // we're going to push this thing ofTranslate(xPos, yPos); // push it this far. Why is this a variable and not a fixed number? ofScale(scale, scale); //scale it this much ofNoFill(); ofSetColor(myOutlines); ofSetLineWidth(MyOutlineWidth); //-----------------h------------------------ ofBeginShape(); ofVertex(0,0); ofVertex(30, 0); ofVertex(30+(Mousereact/2.5),40); ofVertex(70+(Mousereact/2.5),40); ofVertex(70,0); ofVertex(100,0); ofVertex(100+Mousereact,100); // moved Mousereact parameters to update. Was this a good idea? ofVertex(70+Mousereact,100); ofVertex(70+(Mousereact/2),60); ofVertex(30+(Mousereact/2),60); ofVertex(30+Mousereact,100); ofVertex(0+Mousereact,100); ofVertex(0,0); ofEndShape(); ofPushMatrix(); ofTranslate(110, 0); ofBeginShape(); ofVertex(0,0); ofVertex(30, 0); ofVertex(30+Mousereact,100); ofVertex(0+Mousereact,100); ofVertex(0,0); ofEndShape(); ofPopMatrix(); ofPopMatrix(); }
void draw() { ofPushStyle(); ofSetColor(100, 100, 255, 200); ofSetLineWidth(6); ofNoFill(); ofBeginShape(); for (auto it = pts.begin(); it != pts.end(); it++) { ofVertex(it->x, it->y); } ofEndShape(); ofMatrix4x4 m; float theta = sin(ofGetElapsedTimef()) * M_PI / 64.; m.set(cos(theta), -sin(theta), 0, 0, sin(theta), cos(theta), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); ofVec3f sum; int size = 0; for (int i = 0; i < ptss.size(); i++) { for (auto it = ptss[i].begin(); it != ptss[i].end(); it++) { ofVec3f p = ofVec3f(it->x, it->y, 0); sum += p; size++; } } sum = sum / ofVec3f(size); for (int i = 0; i < ptss.size(); i++) { ofBeginShape(); for (auto it = ptss[i].begin(); it != ptss[i].end(); it++) { ofVec3f p = ofVec3f(it->x, it->y, 0); ofVec3f a = sum; p = m * (p - a) + a; ofVertex(p.x, p.y); } ofEndShape(); } ofPopStyle(); }
//-------------------------------------------------------------- void testApp::draw(){ panel.draw(); // draw the waveform ofNoFill(); ofSetColor(255, 255, 255); ofBeginShape(); for (int i = 0; i < 512; i++){ float sample = ofMap(outputBufferCopy[i*2], -1,1, 0,200); ofVertex(i + 100, sample+100); } ofEndShape(); }
void Boid::render(){ ofVec2f origin = ofVec2f(1.0, 0.0); float theta = origin.angle(velocity) + 90; ofSetColor(200, 100); ofPushMatrix(); ofTranslate(location.x, location.y); ofRotate(theta); ofBeginShape(); ofVertex(0, -r * 2); ofVertex(-r, r * 2); ofVertex(r, r * 2); ofEndShape(); ofPopMatrix(); }
void testApp::drawTmpZone() { if(marks.size()==1) { fboZones.begin(); ofClear(0,0); ofSetColor(255); zones.draw(0,0); ofSetColor(255-zoneID); ofPoint p0=marks.front(); ofLine(p0.x,p0.y,p0.x,p0.y); fboZones.end(); } if(marks.size()==2) { fboZones.begin(); ofClear(0,0); ofSetColor(255); zones.draw(0,0); ofSetColor(255-zoneID); ofPoint p0=marks.front(); ofPoint p1=marks.back(); ofLine(p0.x,p0.y,p1.x,p1.y); fboZones.end(); } if(marks.size()>=3) { fboZones.begin(); ofClear(0,0); ofSetColor(255); zones.draw(0,0); ofSetColor(255-zoneID); ofPoint p0=marks.front(); ofBeginShape(); ofCurveVertex(p0.x,p0.y); ofCurveVertex(p0.x,p0.y); for(int i=1;i<(marks.size()-1);i++) { ofPoint p=marks[i]; ofCurveVertex(p.x,p.y); } ofPoint p1=marks.back(); ofCurveVertex(p1.x,p1.y); ofCurveVertex(p1.x,p1.y); ofEndShape(); fboZones.end(); } }
void TextImageContent::roundedRect(float x, float y, float w, float h, float r ) { ofBeginShape() ; ofVertex( x+r , y ) ; ofVertex( x+w-r , y ) ; quadraticBezierVertex( x+w , y , x+w , y+r, x+w-r , y ) ; ofVertex( x+w , y+h-r ) ; quadraticBezierVertex( x+w , y+h , x+w-r , y+h , x+w, y+h-r ) ; ofVertex( x+r , y+h ) ; quadraticBezierVertex( x , y+h , x , y+h-r , x+r , y+h ) ; ofVertex( x , y+r ) ; quadraticBezierVertex( x , y , x+r , y , x , y+r ) ; ofEndShape() ; }
void SMUPentagon::display() { // fill shape ofSetColor(255, 100, 255); ofFill(); ofSetPolyMode(OF_POLY_WINDING_ODD); // normal mode ofBeginShape(); for(int i=0; i<5; i++){ ofVertex(loc.x + vecs[i].x, loc.y + vecs[i].y); } ofEndShape(OF_CLOSE); }
// ------------------------------------ Draw the building contour void FerryBuilding::drawContour() { ofPushStyle(); glLineWidth(2.0 * OFFSCREEN_SCALE); for(int i=0; i<shapes.size(); i++) { ofNoFill(); ofSetColor(255, 0, 255); ofBeginShape(); for(int j=0; j<shapes[i].pnts.size(); j++) { ofVertex(shapes[i].pnts[j].x, shapes[i].pnts[j].y); } ofEndShape(false); } ofPopStyle(); }
void ofApp::plot(vector<float>& buffer, float scale) { ofNoFill(); int n = MIN(1024, buffer.size()); ofRect(0, 0, n, scale); ofPushMatrix(); ofTranslate(0, scale); ofScale(1, -scale); ofBeginShape(); for (int i = 0; i < n; i++) { ofVertex(i, buffer[i]); } ofEndShape(); ofPopMatrix(); }
void ofxFlashDisplayObject :: drawTransformedOutline () { ofNoFill(); ofSetColor( 0, 255, 0 ); ofSetLineWidth( 2 ); ofBeginShape(); ofVertex( _rectTransformed[ 0 ].x, _rectTransformed[ 0 ].y ); ofVertex( _rectTransformed[ 1 ].x, _rectTransformed[ 1 ].y ); ofVertex( _rectTransformed[ 2 ].x, _rectTransformed[ 2 ].y ); ofVertex( _rectTransformed[ 3 ].x, _rectTransformed[ 3 ].y ); ofVertex( _rectTransformed[ 0 ].x, _rectTransformed[ 0 ].y ); ofEndShape( true ); }
void FFTSinewave::draw(){ ofPushMatrix(); ofEnableSmoothing(); ofTranslate(-ofGetWidth()/2, -ofGetHeight()/2); ofSetColor(255); int step = fft_size/col; for (int i = 1; i < fft_size; i += step) { float center = ofGetWidth()/2 + i; ofPushMatrix(); ofTranslate(ofGetWidth()/2, 0); /* for (int j = 0; j < ofGetHeight(); j += 4) { ofPoint pos = ofPoint(sin(j/10.0*i + ofGetElapsedTimef()*10*i) * magnitude[i] + i/2, j); ofCircle(pos.x, pos.y, 1); ofCircle(-pos.x, pos.y, 1); } */ ofSetLineWidth(2); ofNoFill(); ofBeginShape(); for (int j = 0; j < ofGetHeight(); j++) { ofPoint pos = ofPoint(sin((j+ofGetElapsedTimef()*(i + 100))/800.0*powf(i,0.5)) * magnitude[i] + i/2, j); ofVertex(pos.x, pos.y); } ofEndShape(); ofBeginShape(); for (int j = 0; j < ofGetHeight(); j++) { ofPoint pos = ofPoint(sin((j-ofGetElapsedTimef()*(i + 100))/800.0*powf(i,0.5)) * magnitude[i] + i/2, j); ofVertex(-pos.x, pos.y); } ofEndShape(); ofFill(); ofPopMatrix(); } ofDisableSmoothing(); ofPopMatrix(); }
//-------------------------------------------------------------- void SoundInput::drawVolume(float x, float y) { ofPushStyle(); ofPushMatrix(); ofTranslate(x,y,0); ofSetColor(255,70); float width = (float)m_volHistory.size(); ofNoFill(); ofRect(-width, 0, width, m_heightDraw); //printf("drawVolume %.3f-", m_heightDraw); ofSetColor(255,255); ofBeginShape(); for (int i = 0; i < m_volHistory.size(); i++) { if( i == 0 ) ofVertex(-width+i, m_heightDraw); ofVertex(-width+i, m_heightDraw- m_volHistory[i] * m_heightDraw); if( i == m_volHistory.size() -1 ) ofVertex(-width+i, m_heightDraw); } ofEndShape(false); ofSetColor(255,0,0,100); float yMean = m_heightDraw*(1.0f-m_volHistoryMeanFiltered); ofLine(-width,yMean, 0, yMean); #if SOUNDINPUT_USE_FFT ofSetColor(255); m_fft.draw(0, 0, width, m_heightDraw); ofNoFill(); ofSetColor(255); ofRect(0, 0, width, m_heightDraw); #endif ofPopMatrix(); ofPopStyle(); }
//-------------------------------------------------------------- void ofApp::draw(){ ofBackgroundGradient(ofColor::white, ofColor::grey); float ratio_num = ratioNum; float ratio_den = ratioDen; float ratio = ratio_num/ratio_den; float R = 20; float r = R/ratio; float angle = ratio_den*TWO_PI; float renderStep = PI/spiroRenderStep; if (ratio < 1) { R = 325*ratio/(1-ratio/2); r = R/ratio; } ofPushMatrix(); if (!bFullscreen) { ofTranslate(ofGetWidth()/2, ofGetHeight()/2); } else if (bFullscreen == 1) { ofTranslate(ofGetScreenWidth()/2, ofGetScreenHeight()/2); } ofSetColor(spiroColor); if (spiroFill) { ofFill(); } else { ofNoFill(); } ofSetLineWidth(spiroLineWeight); ofBeginShape(); for (float i=0; i<angle; i+= renderStep) { float x = abs(R-r)/2*cos(i) + r/2*cos(-i*ratio); float y = abs(R-r)/2*sin(i) + r/2*sin(-i*ratio); ofVertex(x, y); } ofEndShape(); ofPopMatrix(); if ( bHide ) { gui.draw(); ofSetColor(255); ofDrawBitmapString("(f) fullscreen\n(h) hide controls\n(b) draw black", 20, ofGetHeight() - 50); ofDrawBitmapString("(s) save settings\n(l) load settings", 20 + 200, ofGetHeight() - 50); } }
//---------- void Crossfader::BaseMode::updatePreview() { this->preview.allocate(64,64); this->preview.begin(); ofClear(0,0,0,0); ofPushStyle(); ofFill(); ofSetLineWidth(0); float A, B, position; ofSetColor(255,100,100); ofBeginShape(); ofVertex(0,32); for(int x=0; x<64; x+=2) { position = ofMap(x, 0, 63, -1.0f, 1.0f); this->crossfade(position, A, B); ofVertex(x, 32.0f - A * 32.0f); } ofVertex(64,32); ofEndShape(true); ofSetColor(100,255,100); ofBeginShape(); ofVertex(0,32); for(int x=0; x<64; x+=2) { position = ofMap(x, 0, 63, -1.0f, 1.0f); this->crossfade(position, A, B); ofVertex(x, 32.0f + B * 32.0f); } ofVertex(64,32); ofEndShape(true); ofPopStyle(); this->preview.end(); }
void testApp::myShape1(int _x, int _y, int _rot) { //HEART ofPushMatrix(); ofSetColor(250, 0, 0, 10); ofTranslate(_x, _y); ofRotate(_rot); ofBeginShape(); ofVertex(0, 20); ofBezierVertex(0, -35, 80, 10, 0, 60); ofVertex(0, 20); ofBezierVertex(0, -35, -80, 10, 0, 60); ofEndShape(); ofPopMatrix(); }
void ofxPentagon::pentagon(float centerX, float centerY, float size) { float cos[] = {0.95105654, 0.5877853, -0.5877852, -0.95105654, 0}; float sin[] = {-0.309017, 0.809017, 0.809017, -0.30901697, -1}; float radius = size / 2; ofSetPolyMode(OF_POLY_WINDING_NONZERO); ofNoFill(); ofBeginShape(); for(int i = 0; i < 5; i++){ float tx = cos[i] * radius + centerX; float ty = sin[i] * radius + centerY; ofVertex(tx, ty); } ofEndShape(); }
void shLine::draw( ) { if( linePoints.size( ) > 0 ) { ofNoFill( ); ofBeginShape( ); for( int i = 0; i < linePoints.size( ); i++ ) { ofCurveVertex(linePoints[ i ].getPositionInX( ), linePoints[ i ].getPositionInY( ) ); } ofEndShape( false ); } }