///-------------------------------------------------------------- void PMMotionExtractor::draw(bool drawImage, bool drawHands) { if (hasKinect && drawImage) { auto infraredImage = kinect.getInfraredSource(); auto infraredPixels = infraredImage->getPixels(); for (auto & pixel : infraredPixels) { pixel += pixel * 2; } ofTexture drawTexture; drawTexture.allocate(512, 424, GL_LUMINANCE); drawTexture.loadData(infraredPixels); drawTexture.draw(0, 0, ofGetWidth(), ofGetHeight()); } if(drawHands){ ofPushStyle(); ofNoFill(); ofSetLineWidth(3); ofSetColor(ofColor::red); ofDrawEllipse(handsInfo.rightHand.pos.x * ofGetWidth(), handsInfo.rightHand.pos.y * ofGetHeight(), 20+20*(handsInfo.rightHand.v.x), 20+20*(handsInfo.rightHand.v.y)); ofDrawEllipse(handsInfo.leftHand.pos.x * ofGetWidth(), handsInfo.leftHand.pos.y * ofGetHeight(), 20+20*(handsInfo.leftHand.v.x),20+20*(handsInfo.leftHand.v.y)); //ofDrawBitmapString(handsInfo.rightHand.pos.z, handsInfo.rightHand.pos.x * ofGetWidth() + 10, handsInfo.rightHand.pos.y * ofGetHeight() + 10); //ofDrawBitmapString(handsInfo.leftHand.pos.z, handsInfo.leftHand.pos.x * ofGetWidth() + 10, handsInfo.leftHand.pos.y * ofGetHeight() + 10); ofPopStyle(); } ofDrawBitmapString(positionDetectedCounter, 0, 0); }
// float: x-coordinate of the ellipse // float: y-coordinate of the ellipse // float: width of the ellipse by default // float: height of the ellipse by default void ellipse(float x,float y, float width, float height) { /* // drawing ellipse via ofPath generates a rendering bug when // rendering the stroke ofPath p = ofPath(); handlePathDrawStyle(p); p.setCircleResolution(100); p.ellipse(x,y,width,height); p.draw(); */ if(m_hasFill) { ofFill(); ofSetColor(m_fillColor); //fill color ofDrawEllipse(x,y,width,height); } if( m_hasStroke ) { ofNoFill(); ofSetColor(m_strokeColor);//stroke color ofDrawEllipse(x,y,width,height); } }
void ofApp::draw(){ float width = (float)(3*250) / nBandsToGet; ofSetColor(0); // quad 2 for (int i = 0;i < nBandsToGet; i++){ // (we use negative height here, because we want to flip them // because the top corner is 0,0) ofDrawRectangle(ofGetWidth()/2+i*width,ofGetHeight()/2,width,-(fftSmoothed[i] * 100)); } // quad 1 for (int i = 0;i < nBandsToGet; i++){ // (we use negative height here, because we want to flip them // because the top corner is 0,0) ofDrawRectangle(ofGetWidth()/2-i*width,ofGetHeight()/2,width,-(fftSmoothed[i] * 100)); } // quad 3 for (int i = 0;i < nBandsToGet; i++){ // (we use negative height here, because we want to flip them // because the top corner is 0,0) ofDrawRectangle(ofGetWidth()/2-i*width,ofGetWidth()/2-128,width,+(fftSmoothed[i] * 100)); } // quad 4 for (int i = 0;i < nBandsToGet; i++){ // (we use negative height here, because we want to flip them // because the top corner is 0,0) ofDrawRectangle(ofGetWidth()/2+i*width,ofGetWidth()/2-128,width,+(fftSmoothed[i] * 100)); } for(int i = 0;i < nBandsToGet; i++){ ofNoFill(); ofSetCircleResolution(100); ofDrawEllipse(ofGetWidth()/2, ofGetHeight()/2, (fftSmoothed[i] * 100), (fftSmoothed[i] * 100)); } for(int i = 0;i < nBandsToGet; i++){ ofNoFill(); ofSetCircleResolution(100); ofDrawEllipse(ofGetWidth()/2, ofGetHeight()/2, (fftSmoothed[i] * 200), (fftSmoothed[i] * 200)); } }
//-------------------------------------------------------------- void ofApp::draw(){ ofBackground(25,185,255); ofFill(); ofSetColor(255,0,0); ofDrawEllipse(mouseX-5,mouseY-5,10,10); ofNoFill(); ofSetColor(255,255,255); ofDrawEllipse(mouseX-30,mouseY-30,60,60); }
// draw (no style info) void ofxCurve::draw(bool bDrawControlPoints){ if(bDrawControlPoints){ ofDrawLine(start,startControl); ofDrawLine(end,endControl); ofDrawEllipse(startControl,5,5); ofDrawEllipse(endControl,5,5); } ofDrawBezier(start.x,start.y, start.z,startControl.x,startControl.y, startControl.z,endControl.x,endControl.y,endControl.z,end.x,end.y,end.z); }
//-------------------------------------------------------------- void ofApp::renderRadialSignedNoiseDemo (){ float centerX = radialNoiseDemoX; float centerY = radialNoiseDemoY; // Render the Signed Noise demo, using // the noise as radial displacements to a circle. ofPushMatrix(); ofTranslate(centerX + radialNoiseDemoR,centerY,0); ofEnableAlphaBlending(); ofEnableSmoothing(); ofNoFill(); // Draw a faint plain circle, so that we can better understand // the radial displacements caused by the signed noise later on. ofSetColor(0,0,0, 64); ofSetCircleResolution(256); ofDrawEllipse(0,0, radialNoiseDemoR*2,radialNoiseDemoR*2); // Let's use the signed noise as a radial displacement to a circle. // We render out the points stored in the X and Y arrays. ofMesh wigglyMeshLine; // yes, technically, it's a "mesh" wigglyMeshLine.setMode(OF_PRIMITIVE_LINE_STRIP); float px = 0, py = 0; for (int i=(nSignedNoiseData-1); i>=0; i--){ // From the 'i' iterator, use ofMap to compute both // an angle (around a circle) and an alpha value. float angle = ofMap(i, 0,nSignedNoiseData-1, 0,-TWO_PI) - HALF_PI; float alph = ofMap(i, 0,nSignedNoiseData-1, 1,0 ); wigglyMeshLine.addColor(ofFloatColor(0,0,255, alph)); // Cpmpute the displaced radius float wigglyRadius = radialNoiseDemoR; wigglyRadius += radialNoiseDemoR * signedNoiseData[i]; // Good old-fashioned trigonometry: y = cos(t), x = sin(t) px = wigglyRadius * cos( angle ); py = wigglyRadius * sin( angle ); wigglyMeshLine.addVertex(ofVec2f(px,py)); } // draw the "mesh" (line) ofEnableSmoothing(); wigglyMeshLine.draw(); // draw a little ball at the end ofFill(); ofSetColor(0,0,0, 160); ofDrawEllipse(px,py, 7,7); ofPopMatrix(); }
void Alien::draw(){ ofSetColor(r, g, b); ofFill(); ofDrawEllipse(xPos, yPos, diam, diam); }
void person::draw(float xPos, float yPos){ cout <<"I'm drawing"<< endl; ofDrawEllipse(xPos, yPos, height, height); ofSetColor(r, g, b); ofFill(); }
void ofApp::updatePaintFbo(int x, int y) { paintFbo.begin(); ofClear(0); // draw an ellipse to the paint fbo at the mouse position ofDrawEllipse(x, y, brushRadius, brushRadius); paintFbo.end(); }
//-------------------------------------------------------------- void ofApp::draw(){ angle = ofGetElapsedTimef(); //increment angle based on the time passed float expandFactor = angle/radius; //spacing out the spiral step radius += 20/TWO_PI*expandFactor; //radius grows exponensially origin.x = ofGetWidth()/2; origin.y = ofGetHeight()/2; pos.x = origin.x+radius*cos(angle); pos.y = origin.y+radius*sin(angle); //ofEnableAlphaBlending(); ofSetColor(255, 165, 0); //ofDisableAlphaBlending(); ofDrawEllipse(pos.x, pos.y, 30, 30); // cout<<"angle: "<<angle<<endl; // cout<<"dimmer: "<<dimmer<<endl; // cout<<"pos.x: "<<pos.x<<endl; // cout<<"pos.y: "<<pos.y<<endl; cout<<"radius: "<<radius<<endl; cout<<"expand: "<<expandFactor<<endl; }
void Player::display(){ cout <<"drawing\n"; ofDrawEllipse(x, y, 10, 10); // for (int i=0; i<pointArray.size(); i++){ // myfont.drawString("*",pointArray[i].x, pointArray[i].y); // } }
//-------------------------------------------------------------- void ofApp::draw(){ ofDrawEllipse(ofGetWidth()/2, ofGetHeight()/2, 100, 100); if(loop){ ofEndSaveScreenAsPDF(); loop = false; } }
//-------------------------------------------------------------- void ofApp::renderNoisyRobotArmDemo(){ float t = ofGetElapsedTimef(); float shoulderNoiseAngleDegrees = 90 + 70.0 * ofSignedNoise(t * 1.00); float elbowNoiseAngleDegrees = 60 + 80.0 * ofSignedNoise(t * 0.87); float wristNoiseAngleDegrees = (2.5 * 72) + 45.0 * ofSignedNoise(t * 1.13); float noisyR = ofNoise(t * 0.66); // different multiplicative step-factors float noisyG = ofNoise(t * 0.73); // guarantee that our color channels are float noisyB = ofNoise(t * 0.81); // not all (apparently) synchronized. ofEnableSmoothing(); ofEnableAlphaBlending(); ofSetCircleResolution(12); ofSetLineWidth(1.0); ofPushMatrix(); // Translate over to the shoulder location; draw it ofTranslate(ofGetWidth()/2, 540, 0); ofRotate(shoulderNoiseAngleDegrees, 0, 0, 1); drawNoisyArmRect(100,24); // Translate over to the forearm location; draw it ofTranslate(76, 0, 0); ofRotate(elbowNoiseAngleDegrees, 0, 0, 1); drawNoisyArmRect(90,16); // Translate over to the hand location; draw it. // Note that the color of the 'hand' is controlled by noise. ofTranslate(74, 0, 0); ofRotate(wristNoiseAngleDegrees, 0, 0, 1); ofSetCircleResolution(5); // a kludgy "pentagon" ofFill(); ofSetColor (ofFloatColor(noisyR, noisyG, noisyB, 0.75)); ofDrawEllipse(-10,0, 60,60); ofNoFill(); ofSetColor(0); ofDrawEllipse(-10,0, 60,60); ofSetCircleResolution(12); ofSetColor(0); ofFill(); ofDrawEllipse(0,0, 7,7); ofPopMatrix(); }
// fonction invoquée lors d'une mise à jour du rendu de la fenêtre de l'application void ofApp::draw() { ofClear(191); ofFill(); ofSetColor(255); ofDrawTriangle( vertex1_X, vertex1_Y, vertex2_X, vertex2_Y, vertex3_X, vertex3_Y); ofSetColor(0); ofDrawEllipse(vertex1_X, vertex1_Y, pointRadius, pointRadius); ofDrawEllipse(vertex2_X, vertex2_Y, pointRadius, pointRadius); ofDrawEllipse(vertex3_X, vertex3_Y, pointRadius, pointRadius); }
void Particle::draw() { if(live){ float size = ofMap(time, 0, lifeTime, 2, 5); ofColor color = ofColor::indianRed; float hue = ofMap(time, 0, lifeTime, 120, 255); color.setHue(hue); ofSetColor(color); ofDrawEllipse(pos, size, size); } }
//------------------------------------------------------------------------------------ void Mosquitoes::draw() { //Create the mosquito shape ofPushMatrix(); ofTranslate(mPosition.x, mPosition.y, mPosition.z); ofSetColor(168,161,151); ofDrawCircle(0,0,0,mSize); //Head ofDrawEllipse(0, 16, 7, 30); //Body // 2 flapping wings ofSetColor(33,33,33,50); ofDrawEllipse(-13, 8 + Mosquitoes::flappyWings(), 25, 7); ofDrawEllipse(13, 8 + Mosquitoes::flappyWings(), 25, 7); //Mouth ofSetColor(0); ofDrawLine(0, 0-3, 0, 0-20); ofPopMatrix(); }
void ofApp::guy1(ofPoint center, float length, float width){ ofSetColor(ofRandom(200,255),ofRandom(200,255),ofRandom(200,255),ofRandom(10,200)); // Monser dude ofDrawEllipse(center, width, length); ofSetColor(0,ofRandom(200,255),ofRandom(200,255),ofRandom(0,30)); ofDrawEllipse(center +ofRandom(-10, 30), width*4, length); ofSetColor(0,ofRandom(10,55),ofRandom(200,255),ofRandom(0,30)); ofDrawEllipse(center - ofRandom(-10, 30), width*4, length); ofSetColor(0,ofRandom(200,255),ofRandom(200,255),ofRandom(0,30)); ofDrawEllipse(center - ofRandom(-40, 30), width*4, length*3); ofSetColor(0,0,0,ofRandom(0,200)); ofDrawRectangle(center.x + ofRandom(-80,80), center.y + ofRandom(-80,80) , ofRandom(width/2), ofRandom(length/2)); //background noise ofSetColor(255,255,255,ofRandom(100)); ofDrawRectangle(ofRandom(ofGetWidth()),ofRandom(ofGetHeight()),ofRandom(20),ofRandom(20)); ofSetColor(255,255,255,ofRandom(100)); ofDrawRectangle(ofRandom(ofGetWidth()),ofRandom(ofGetHeight()),ofRandom(20),ofRandom(20)); ofSetColor(255,255,255,ofRandom(100)); ofDrawRectangle(ofRandom(ofGetWidth()),ofRandom(ofGetHeight()),ofRandom(20),ofRandom(20)); }
//-------------------------------------------------------------- void ofApp::draw(){ time = ofGetElapsedTimef() - timeStump; switch (stat) { case s01: ofDrawEllipse(0, 0, 100, 100); break; case s02: ofDrawEllipse(100, 100, 100, 100); break; case s03: ofDrawEllipse(200, 200, 100, 100); break; default: break; } }
void Calibrator::draw(){ ofScale(1.0, 1.0*outputRectangle.getAspectRatio()); ofFill(); ofSetColor(255, 255, 255, 127); ofDrawRectangle(0,0,1.0,1.0); ofSetColor(255, 255); ofDisableDepthTest(); if(!plane.expired()){ shared_ptr<ofxStereoscopy::Plane> p = plane.lock(); if(rightEye){ p->drawRight(0,1,1,-1); // no idea why the y axis of the texture needs reversion ofSetColor(p->rightColor); }else{ p->drawLeft(0,1,1,-1); // no idea why the y axis of the texture needs reversion ofSetColor(p->leftColor); } for (shared_ptr<ofAbstractParameter> cornerPoint : quad->outputPoints) { shared_ptr<ofParameter<ofVec3f>> cp = std::dynamic_pointer_cast<ofParameter<ofVec3f>>(cornerPoint); ofVec3f cpVec = cp->get(); if (cpVec.distance(mouseVec) < 0.03) { ofSetColor(ofColor::yellow); } else { ofSetColor(ofColor::greenYellow); } ofDrawEllipse(cpVec,0.03, 0.03*outputAspect); } for(auto point : points){ ofSetColor(ofColor::yellow); ofDrawEllipse(point->get(), 0.04, 0.04*outputAspect); } } }
//-------------------------------------------------------------- void ofApp::draw(){ ofBackground(0); ofSetColor(255, 255, 0); ofDrawEllipse(xPosition, 20, 20, 20); int xMouse = ofGetMouseX(); int yMouse = ofGetMouseY(); if (ofGetMousePressed() == true) { ofSetColor(255, 0, 0); } else { ofSetColor(0, 255, 0); } ofDrawEllipse(xMouse, yMouse, 20, 20); }
void ofApp::diamond(ofPoint center, float length, float width){ // line 1 (x1, y1, x2, y2) ofSetColor(0, 200, 50, 200); ofDrawLine(center.x - width/2, center.y + length/2, center.x, center.y-length/2); ofDrawLine(center.x, center.y-length/2, center.x + width/2, center.y + length/2); ofDrawLine(center.x + width/2, center.y + length/2, center.x, center.y+length); ofDrawLine(center.x, center.y + length, center.x-width/2, center.y+length/2); ofSetColor(200, 0, 50, 200); ofDrawEllipse(mouseX,mouseY,length,width); }
//-------------------------------------------------------------- void ofApp::update(){ ofSetWindowTitle(ofToString(ofGetFrameRate())); rip.begin(); ofFill(); ofSetColor(ofNoise( ofGetFrameNum() ) * 255 * 5, 255); ofDrawEllipse(mouseX,mouseY, 10,10); rip.end(); rip.update(); bounce << rip; // bounce.update(); }
void Forma::formata(float diameter, float circumference, float angle, float size, float maxSize) { ofNoFill(); ofDrawEllipse(0, 0, diameter, size); ofRotate(angle); ofDrawEllipse(0, 0, circumference, size); diameter = circumference*size; if(diameter < maxSize) { ofPushMatrix(); ofRotate(angle); formata(diameter, circumference, angle, size, maxSize); ofPopMatrix(); } }
void GameView::drawFieldContent(Field field, int x, int y, int width, int height) { ofSetColor(ofColor::black); switch(field) { case Field::X: // draw X ofSetLineWidth(LINE_WIDTH); ofDrawLine(x, y, x + width, y + height); ofDrawLine(x, y + height, x + width, y); break; case Field::O: // draw O ofSetCircleResolution(100); ofDrawEllipse(x + width / 2, y + height / 2, width, height); ofSetColor(255); ofDrawEllipse(x + width / 2, y + height / 2, width - 2 * LINE_WIDTH, height - 2 * LINE_WIDTH); break; case Field::Empty: default: // draw nothing break; } }
//-------------------------------------------------------------- void ofApp::draw(){ float blurAmount = ofMap(mouseX, 0, ofGetWidth(), 0, 10.0); // draw mask int FBO maskFbo.begin(); blur.begin(blurAmount, 10); // blur begin ofSetCircleResolution(64); ofDrawEllipse(ofGetWidth()/2, ofGetHeight()/2, ofGetHeight(), ofGetHeight()); blur.end(); // blur end maskFbo.end(); alphaMask->draw(); }
//---------------------------------------------------------- void ofxVectorGraphics::ellipse(float x1,float y1, float w, float h){ if(bDraw){ ofDrawEllipse(x1, y1, w, h); } if(bRecord){ if(bFill){ //there is no filled ellipse in non-path mode creeps.startPath(); creeps.addEllipse(x1, y1, w, h); creeps.endPath(CreEPS::FILL); } else creeps.ellipse(x1, y1, w, h); } }
//! Set the position to `pos' void ofSlider::setPosition(int pos) { char tempStr[1024]; int newPos = pos; if (pos < x) { newPos = x; } else if (pos > x + width) { newPos = x + width; } buttonX = newPos; ofSetHexColor(0x000000); ofDrawEllipse(buttonX, buttonY(), BUTTON_BG_SIZE, BUTTON_BG_SIZE * BUTTON_ELLIPSE_FACTOR); if (value() == 0 || value() == 255) { ofSetHexColor(0x707070); } else { ofSetHexColor(0xFFFFFF); } ofDrawEllipse(buttonX, buttonY(), BUTTON_FG_SIZE, BUTTON_FG_SIZE * BUTTON_ELLIPSE_FACTOR); sprintf(tempStr, "%i", value()); ofSetHexColor(0x808080); int stringWidth = font.stringWidth(tempStr); font.drawString(tempStr, x + width + 40 - stringWidth, buttonY() + height / 2); }
void mgsRileyEllipsesAndSquares::drawScene() { frame.begin(); ofSetColor(0, 20); ofDrawRectangle(0, 0, dimensions.width, dimensions.height); ofSetColor(255); for (float i = 0; i < dimensions.width; i+=unitSize) { for (float j = 0; j < dimensions.height; j+=unitSize) { if ((int)(i/unitSize) % 2 == 0 && (int)(j/unitSize) % 2 == 0) { if ((i > px0 && i < px1 && j > py0 && j < py1) || (i > px2 && i < px3 && j > py2 && j < py3) || (i > px4 && i < px5 && j > py4 && j < py5) || (i > px6 && i < px7 && j > py6 && j < py7)) { ofDrawRectangle(i+unitSize, j+unitSize, unitSize, unitSize); ofDrawRectangle(i, j, unitSize, unitSize); } else { ofDrawEllipse(i+unitSize/2, j+unitSize/2, unitSize, unitSize); ofDrawEllipse(i+unitSize/2+unitSize, j+unitSize/2+unitSize, unitSize, unitSize); } } } } frame.end(); }
void mastersaber::draw(){ ofSetColor(SaberColor); // ofEllipse(pX,pY, saberW, saberH); ofDrawEllipse(pX, pY, saberW, saberH); }
void VisionDebug::draw(const FaceAnnotation::Landmark& landmark) { ofColor background= ofColor(0, 80); ofColor foreground = ofColor(0, 0); if (glm::distance(glm::vec3(ofGetMouseX(), ofGetMouseY(), 0), landmark.position()) < 5) { foreground = ofColor(255); background = ofColor(0); } ofDrawBitmapStringHighlight(landmark.name(), landmark.position(), foreground, background); ofNoFill(); ofDrawEllipse(landmark.position().x, landmark.position().y, 10, 10); }