//---------------------------------------------------------------- void MainScreen::drawPanel() { ofSetColor(255); float width = ofGetWidth(); font.drawString("Iterations: ", width - 280, 30); font.drawString(to_string(maxiter), width - 150, 30); font.drawString("Sampling: ", width - 280, 60); font.drawString(to_string(supersample), width - 150, 60); font.drawString("View Size: ", width - 280, 90); font.drawString(to_string(scale), width - 150, 90); font.drawString("Centre X: ", width - 280, 120); font.drawString(to_string(offset.x), width - 150, 120); font.drawString("Centre Y: ", width - 280, 150); font.drawString(to_string(offset.y), width - 150, 150); ofDrawRectangle(width - 300, ofGetHeight() - 150, 300, 150); for (int i = 0; i < 251; i += 5) { float ang = TWO_PI * i / 250.0; ofSetColor(0, 255, 0, 150); ofDrawCircle(width - 275 + i, 400 - colorgain.y * 50 * sin(ang - coloroffset.y), 3); ofSetColor(255, 0, 0, 150); ofDrawCircle(width - 275 + i, 400 - colorgain.x * 50 * sin(ang - coloroffset.x), 3); ofSetColor(0, 0, 255, 150); ofDrawCircle(width - 275 + i, 400 - colorgain.z * 50 * sin(ang - coloroffset.z), 3); } }
//-------------------------------------------------------------- void ofApp::draw(){ // voronoi.draw(); // Or feel free to draw the voronoi diagram yourself: ofRectangle bounds = voronoi.getBounds(); ofSetLineWidth(0); ofNoFill(); ofSetColor(ofColor::fromHsb(ofRandom(255),randSat,220)); ofDrawRectangle(bounds); vector <ofxVoronoiCell> cells = voronoi.getCells(); for(int i=0; i<cells.size(); i++) { ofSetColor(ofColor::fromHsb(randColor,randSat,220)); ofFill(); ofMesh mesh; mesh.setMode(OF_PRIMITIVE_LINE_LOOP); mesh.addVertices(cells[i].pts); mesh.draw(); // if (activateMesh){ // mesh.clear(); // for(int j = 0; j < cells[i].pts.size(); j++) { // mesh.addVertex(cells[i].pt); // mesh.addVertex(cells[i].pts[j]); // } // ofSetColor(r, g, b); // mesh.draw(); // } // Draw cell points int offset = scalarPointsVector.scale[i]; if(!diffOrSameColors) ofSetColor(ofColor::fromHsb((randColor2*offset)%255,randSat,220)); else ofSetColor(ofColor::fromHsb(randColor2,randSat,220)); ofFill(); if (sameSize) ofDrawCircle(cells[i].pt, 4); else if (dots); else ofDrawCircle(cells[i].pt, scalarPointsVector.scale[i]); } if (selectedActivate){ int pointCount = 100; int seed = 33; ofRectangle bounds = ofRectangle(10, 10, ofGetWidth()-20, ofGetHeight()-20); //points = generateRandomPoints(pointCount, seed, bounds); scalarPointsVector.points[selectedPointIndex] = ofPoint(univx, univy); voronoi.setBounds(bounds); voronoi.setPoints(scalarPointsVector.points); voronoi.generate(); } }
void BaseParticle::draw() { // we can calculate the heading of the // particle by looking at the velocity vector. float heading = ofRadToDeg(atan2(velocity.y, velocity.x)); // we will change the color based on the age ofSetColor(255,ofMap(age,0,maxAge,127,0)); ofFill(); // ofPushMatrix + ofTranslate + ofRotateZ ... + ofPopMatrix ofPushMatrix(); ofTranslate(position); ofRotateZ(heading); // rotate z angle // draw the filled circle ofDrawCircle(0,0,10); // draw the outline of the circle ofNoFill(); ofSetColor(255,ofMap(age,0,maxAge,255,0)); ofDrawCircle(0,0,10); // draw a heading line (this is pointing in the right direction // because we used ofRotateZ above ... ofDrawLine(0,0,20,0); // pop the transformation matrix ofPopMatrix(); }
void Cell::draw() { state = stateNext; if (dispStyle == 0) { if (state == 1) { if (myFriends < 20) { ofFill(); ofSetColor(0, 0, 0, 10); ofDrawCircle(x, y, cellSize + age); } else if ((myFriends >= 20)&&(myFriends < 150)) { ofFill(); ofSetColor(146, 168, 209, 70); ofDrawCircle(x, y, cellSize + age); } else if (myFriends >= 150) { ofFill(); ofSetColor(247, 202, 201, 70); ofDrawCircle(x, y, cellSize + age); } } } else { if (state == 1) { ofNoFill(); ofSetColor(0); ofDrawRectangle(x, y, cellSize, cellSize); } else { ofFill(); ofSetColor(0); ofDrawRectangle(x, y, cellSize, cellSize); } } }
//-------------------------------------------------------------- void ofApp::drawGui() { guiFPS = (int)(ofGetFrameRate() + 0.5); // calculate minimum fps deltaTimeDeque.push_back(deltaTime); while (deltaTimeDeque.size() > guiFPS.get()) deltaTimeDeque.pop_front(); float longestTime = 0; for (int i=0; i<deltaTimeDeque.size(); i++){ if (deltaTimeDeque[i] > longestTime) longestTime = deltaTimeDeque[i]; } guiMinFPS.set(1.0 / longestTime); ofPushStyle(); ofEnableBlendMode(OF_BLENDMODE_ALPHA); gui.draw(); // HACK TO COMPENSATE FOR DISSAPEARING MOUSE ofEnableBlendMode(OF_BLENDMODE_SUBTRACT); ofDrawCircle(ofGetMouseX(), ofGetMouseY(), ofGetWindowWidth() / 300.0); ofEnableBlendMode(OF_BLENDMODE_ADD); ofDrawCircle(ofGetMouseX(), ofGetMouseY(), ofGetWindowWidth() / 600.0); ofPopStyle(); }
void ofApp::drawMotherFish() { // Mother fish scale float sc = 10; float tailSize = 1*sc; float fishLength = 2*sc; float fishHead = tailSize; float tailangle = 0; ofPushMatrix(); ofTranslate(kinectProjector->kinectCoordToProjCoord(motherFish.x+tailSize, motherFish.y)); ofFill(); ofSetColor(ofColor::blueSteel); ofDrawCircle(-0.5*sc, 0, motherPlatformSize); ofFill(); ofSetColor(255); ofPolyline fish; fish.curveTo( ofPoint(-fishLength-tailSize*cos(tailangle+0.8), tailSize*sin(tailangle+0.8))); fish.curveTo( ofPoint(-fishLength-tailSize*cos(tailangle+0.8), tailSize*sin(tailangle+0.8))); fish.curveTo( ofPoint(-fishLength, 0)); fish.curveTo( ofPoint(0, -fishHead)); fish.curveTo( ofPoint(fishHead, 0)); fish.curveTo( ofPoint(0, fishHead)); fish.curveTo( ofPoint(-fishLength, 0)); fish.curveTo( ofPoint(-fishLength-tailSize*cos(tailangle-0.8), tailSize*sin(tailangle-0.8))); fish.curveTo( ofPoint(-fishLength-tailSize*cos(tailangle-0.8), tailSize*sin(tailangle-0.8))); fish.close(); ofSetLineWidth(2.0); fish.draw(); ofSetColor(255); ofDrawCircle(0, 0, 5); ofPopMatrix(); }
//-------------------------------------------------------------- void ofApp::draw(){ ofSetCircleResolution(25); ofSetColor(ofColor::darkOliveGreen); ofDrawCircle(eX, eY, 45); ofSetColor(ofColor::white); //left eye ofDrawCircle(eX - 20, eY - 15, 13); //right eye ofDrawCircle(eX + 20, eY - 15, 13); //pupils ofSetColor(ofColor::black); ofDrawCircle(eX - 15, eY - 12, 4); ofDrawCircle(eX + 15, eY - 12, 4); //mouth ofSetLineWidth(2); ofDrawLine(eX - 25, eY + 15, eX + 25, eY + 15); ofSetColor(ofColor::lightPink); ofDrawBezier(eX + 5, eY + 15, eX + 13, eY + 30, eX + 13, eY + 30, eX + 24, eY + 15); }
void ofApp::drawBackgrounds(){ //background circles for(int i = 0; i < 8; i++){ ofSetColor(ofColor(ofRandom(50,200),ofRandom(100, 200),ofRandom(150,250),100)); ofFill(); ofDrawCircle(ofRandom(-500,500), ofRandom(-1000, -50), ofRandom(20,40)); } for(int i = 0; i < 10; i++){ ofSetColor(ofColor(ofRandom(0,200),ofRandom(100, 255),ofRandom(100,250),ofRandom(50,200))); ofFill(); int xVal[] = {-50, -468, -300, 200, -100, 500, 400, -350, 50, 136}; ofDrawCircle(xVal[i], (-650 * i/3) - 50 , ofRandom(40,45)); } for(int i = 0; i < 2; i++){ ofSetColor(ofColor(ofRandom(50,255),ofRandom(10, 150),ofRandom(150,250),100)); ofFill(); ofDrawCircle(ofRandom(-500,500), ofRandom(-2000, -1000), ofRandom(20,40)); } //background for "second stage" ofSetColor(255); ofDrawRectangle(-ofGetWidth()/2, -1950, ofGetWidth(), -5000); //recursive background in "second stage" ofPushMatrix(); ofTranslate(0,-3000); drawRecursiveBackground(500, -ofGetElapsedTimef()*50); ofPopMatrix(); }
void Neuron::display() { ofSetLineWidth(2); if (type) { if (spiked) { pulseColorRG = 140; pulseColorB = 40; } ofSetColor(240-pulseColorRG,240-pulseColorRG,240-pulseColorB); pulseColorRG *= 0.8; pulseColorB *= 0.8; ofFill(); ofDrawCircle(loc, r); ofNoFill(); ofSetColor(100,100,200); ofDrawCircle(loc, r); } if (!type) { if (spiked){ pulseColorRG = 140; pulseColorB = 40; } ofSetColor(240-pulseColorB,240-pulseColorRG,240-pulseColorRG); pulseColorRG *= 0.8; pulseColorB *= 0.8; ofFill(); ofDrawCircle(loc, r); ofNoFill(); ofSetColor(200,100,100); ofDrawCircle(loc, r); } ofSetColor(0); ofDrawBitmapString(ofToString(ID+1), loc.x-4, loc.y+4); spiked = false; }
//-------------------------------------------------------------- void Flock::draw() { ofPushStyle(); for(int i=0; i<particles.size(); ++i) { Particle &p = particles[i]; float random = ofRandom(125, 255); ofNoFill(); ofSetColor(1, random, random * 0.75); ofDrawCircle( particles[i].position, particles[i].mass); ofFill(); ofDrawCircle( particles[i].position, particles[i].mass * 0.3); } ofPopStyle(); for(int i=0; i<attractors.size(); ++i) { ofFill(); ofDrawCircle(attractors[i].position,attractors[i].mass * .1); } }
void Tree::seed1(float dotSize, float angle, float x, float y) { ofSetColor(255, 0, 0); ofFill(); //nested if statement if(dotSize >1.0f) { float r = ofRandomuf(); // gives you a random number between 0 & 1 //first if statement will happen 98 of time if(r>0.02f) { ofDrawCircle(x,y,dotSize); float newX = x + cos(angle) * dotSize; float newY = y + sin(angle) * dotSize; seed1(dotSize*0.99f, angle+angleOffSetA, newX, newY); //- and + changes the angle of rotating } else { ofDrawCircle(x,y,dotSize); float newX = x + cos(angle) * dotSize; float newY = y + sin(angle) * dotSize; seed1(dotSize*0.99f, angle-angleOffSetA, newX, newY); seed2(dotSize*0.4f, angle+angleOffSetB, newX, newY); seed1(dotSize*0.6f, angle-angleOffSetB, newX, newY); } } }
//-------------------------------------------------------------- void ofApp::update(){ ofEnableAlphaBlending(); int mousex = (ofGetMouseX() / (float) ofGetWidth()) * 400; //lets draw some graphics into our two fbos fbo_a.begin(); ofClear(0,0,0, 0); ofPushStyle(); ofFill(); ofSetColor(ofColor::red); ofDrawCircle(mousex, 100, 50); ofPopStyle(); fbo_a.end(); fbo_b.begin(); ofClear(0,0,0, 0); ofPushStyle(); ofFill(); ofSetColor(ofColor::blue); ofDrawCircle(400 - mousex, 300, 50); ofPopStyle(); fbo_b.end(); }
//draw your keyframes into bounds void ofxTLEmptyKeyframes::draw(){ ofPushStyle(); ofFill(); //show the current color as background based on the playhead position ofSetColor(getCurrentColor(), 100); ofDrawRectangle(bounds); for(int i = 0; i < keyframes.size(); i++){ //make sure it's on screen if(isKeyframeIsInBounds(keyframes[i])){ //we know the type because we created it in newKeyframe() //so we can safely cast ofxTLEmptyKeyframe* emptyKeyframe = (ofxTLEmptyKeyframe*)keyframes[i]; if(hoverKeyframe == emptyKeyframe){ ofSetColor(timeline->getColors().highlightColor); } else if(isKeyframeSelected(emptyKeyframe)){ ofSetColor(timeline->getColors().textColor); } else{ ofSetColor(timeline->getColors().keyColor); } ofVec2f screenPoint = screenPositionForKeyframe(emptyKeyframe); ofDrawCircle(screenPoint, 7); ofSetColor(emptyKeyframe->color); ofDrawCircle(screenPoint, 5); } } ofPopStyle(); }
//-------------------------------------------------------------- void NeoPixelRing16px::drawGrabRegion(bool hideArea) { if (hideArea == true) { // Draw Interaction Area ofPushStyle(); ofNoFill(); ofSetLineWidth(2); ofSetColor(255, 255); ofDrawCircle(_pos.x, _pos.y, radius+12); ofDrawCircle(_pos.x, _pos.y, radius-12); ofPopStyle(); // Visualise the Grabber ofSetColor(255, 175); ofNoFill(); } else { // Visualise the Grabber ofSetColor(0, 175); ofNoFill(); } ofDrawCircle(_pos.x, _pos.y, radius+6); ofDrawCircle(_pos.x, _pos.y, radius-6); for (int i = 0; i < pos.size(); i++) { ofDrawCircle(pos[i]+ofVec2f(_pos.x-x, _pos.y-y),2); } }
//-------------------------------------------------------------- void ofApp::draw(){ ofEnableAlphaBlending(); ofBackground(74,158,216); ofTranslate(ofGetWidth()/2, ofGetHeight()/2); float size1 = 30; float size2 = 15; float pos = 190; float posY = 330; for (int t=0; t<size1; t+=size1){ for (int h=0; h<size1; h+=size1) { for(float g=0; g<20; g+= 0.3){ ofSetLineWidth(1); ofNoFill(); ofSetCircleResolution(3+g); ofRotateY(g*5); ofDrawCircle(t*3, h*3, g*10+size1); ofSetLineWidth(size2); ofDrawCircle(t*3+pos*2, h*3, size2); ofDrawCircle(t*3-pos, h*3-posY+g*10, size2); ofDrawCircle(t*3-pos, h*3+posY-g*10, size2); //ofRotate(g*2); } } } if(loop){ ofEndSaveScreenAsPDF(); loop = false; } }
//-------------------------------------------------------------- void ofApp::draw(){ ofEnableAlphaBlending(); ofSetColor(255,255,255,100); ofDrawRectangle(100,ofGetHeight()-300,5*128,200); ofDisableAlphaBlending(); // draw the fft resutls: ofSetColor(255,255,255,255); float width = (float)(5*128) / nBandsToGet; 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(100+i*width,ofGetHeight()-100,width,-(fftSmoothed[i] * 200)); } // finally draw the playing circle: ofEnableAlphaBlending(); ofSetColor(255,255,255,20); ofDrawCircle(px, py,50); ofDisableAlphaBlending(); ofSetHexColor(0xffffff); ofDrawCircle(px, py,8); }
//-------------------------------------------------------------- void ofApp::draw(){ ofSetColor(200, 100, 100); ofDrawCircle(x, y, 50); ofSetColor(ofColor::darkBlue); ofDrawCircle(ex, ey, 25); }
void Kim::draw(){ ofSetColor(ofRandom(200), ofRandom(200), ofRandom(200), ofRandom(200)); ofDrawCircle(pos.x + ofRandom(20), pos.y + ofRandom(20), 10); ofSetColor(ofRandom(200), ofRandom(200), ofRandom(200), ofRandom(200)); ofDrawCircle(pos.x + ofRandom(50), pos.y - ofRandom(50), 10); ofSetColor(ofRandom(200), ofRandom(200), ofRandom(200), ofRandom(200)); ofDrawCircle(pos.x - ofRandom(50), pos.y + ofRandom(50), 10); }
void ofApp::draw() { ofBackground(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) { float normalizedDistance = ofMap(searchResults[i].second, radius * radius, 0, 0, 1, true); ofSetColor(255, 255, 0, normalizedDistance * 127); ofDrawCircle(points[searchResults[i].first], 5); if (points[searchResults[i].first].x == 0 || points[searchResults[i].first].y == 0) { std::cout << points[searchResults[i].first] << " i = " << i << " dist= " << searchResults[i].second << std::endl; } if (MODE_NEAREST_N == mode) { ofSetColor(255, 127); ofDrawBitmapString(ofToString(i), points[searchResults[i].first]); } } if (MODE_RADIUS == mode) { ofNoFill(); ofSetColor(255, 127);//, 0, 0, 50); ofDrawCircle(mouse, radius); } 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(), ofVec2f(30, 30)); }
//-------------------------------------------------------------- void ofApp::draw(){ //--------------------------- circles //let's draw a circle: ofSetColor(255,130,0); float radius = 50 + 10 * sin(counter); ofFill(); // draw "filled shapes" ofDrawCircle(100,400,radius); // now just an outline ofNoFill(); ofSetHexColor(0xCCCCCC); ofDrawCircle(100,400,80); // use the bitMap type // note, this can be slow on some graphics cards // because it is using glDrawPixels which varies in // speed from system to system. try using ofTrueTypeFont // if this bitMap type slows you down. ofSetHexColor(0x000000); ofDrawBitmapString("circle", 75,500); //--------------------------- rectangles ofFill(); for (int i = 0; i < 200; i++){ ofSetColor((int)ofRandom(0,255),(int)ofRandom(0,255),(int)ofRandom(0,255)); ofDrawRectangle(ofRandom(250,350),ofRandom(350,450),ofRandom(10,20),ofRandom(10,20)); } ofSetHexColor(0x000000); ofDrawBitmapString("rectangles", 275,500); //--------------------------- transparency ofSetHexColor(0x00FF33); ofDrawRectangle(400,350,100,100); // alpha is usually turned off - for speed puposes. let's turn it on! ofEnableAlphaBlending(); ofSetColor(255,0,0,127); // red, 50% transparent ofDrawRectangle(450,430,100,33); ofSetColor(255,0,0,(int)(counter * 10.0f) % 255); // red, variable transparent ofDrawRectangle(450,370,100,33); ofDisableAlphaBlending(); ofSetHexColor(0x000000); ofDrawBitmapString("transparency", 410,500); //--------------------------- lines // a bunch of red lines, make them smooth if the flag is set ofSetHexColor(0xFF0000); for (int i = 0; i < 20; i++){ ofDrawLine(600,300 + (i*5),800, 250 + (i*10)); } ofSetHexColor(0x000000); ofDrawBitmapString("lines\npress 's' to toggle smoothness", 600,500); }
void ring::draw(){ ofSetLineWidth(3); ofNoFill(); ofDrawCircle(pos.get(), size); ofFill(); ofSetColor(0, 255, 0); ofDrawCircle(pos.get(),10); }
//-------------------------------------------------------------- void ofApp::draw(){ ofBackground(30); // Draw eye position ofSetColor(0, 255, 0); ofFill(); if (mEyeX.hasLeftEye()) { ofPoint p = mEyeX.getLeftEyeNormalized(); ofDrawCircle( p.x * ofGetWidth(), p.y * ofGetHeight(), (1. - p.z) * 80); } if (mEyeX.hasRightEye()) { ofPoint p = mEyeX.getRightEyeNormalized(); ofDrawCircle( p.x * ofGetWidth(), p.y * ofGetHeight(), (1. - p.z) * 80); } // Draw gaze point ofSetColor(255, 255, 255); ofDrawCircle(mEyeX.getGazePointData().X, mEyeX.getGazePointData().Y, 20); // Draw fixation switch (mEyeX.getFixationData().FixationDataMode) { case TX_FIXATIONDATAEVENTTYPE_BEGIN: ofSetColor(255, 0, 0); break; case TX_FIXATIONDATAEVENTTYPE_END: ofSetColor(0, 0, 255); break; case TX_FIXATIONDATAEVENTTYPE_DATA: ofSetColor(255, 0, 255); break; } ofNoFill(); ofDrawCircle(mEyeX.getFixationPoint(), 25); /* stringstream ss; ss << "Output information about your eyes" << endl; ss << "- Left Eye Position : " << tx.getLeftEyePosition() << endl; ss << "- Right Eye Position : " << tx.getRightEyePosition() << endl; ss << "Output information about your eyes (Normalized)" << endl; ss << "- Left Eye Position : " << tx.getLeftEyePosNorm() << endl; ss << "- Right Eye Position : " << tx.getRightEyePosNorm() << endl; ss << "Output information aboud your gaze position" << endl; ss << "- Gaze position: " << tx.getGaze() << endl; ofSetColor(255); ofDrawBitmapString(ss.str(), 20, 20); */ }
//-------------------------------------------------------------- void ofApp::drawWaves(){ float rad = 0.0; rad=ofLerp(0.0, ofGetHeight(), (ofGetElapsedTimef()-wTimeStamp)/5); ofSetColor(255); ofDrawCircle(ofGetWidth()/2, ofGetHeight()/2, rad); ofSetColor(0); ofDrawCircle(ofGetWidth()/2, ofGetHeight()/2, CLAMP(rad-10,0,rad)); if(rad>ofGetHeight()) playMode=-1; // turn off after 10 seconds }
//-------------------------------------------------------------- void ofApp::draw(){ ofBackground(25); float time = ofGetElapsedTimef(); float offset = ofMap(sin(time), -1, 1, 0, 0.2); float xOrigin = 400.0; float yOrigin = 400.0; float dotAmount = 300; float radiusSize = 125; float outerRadiusSize = 260; for (int i = 0; i < dotAmount; i++){ for (int j = 0; j < 10; j++){ //float radius = ofMap(sin(time + (i * .2)), -1, 0, 0, 100); float radius = ofMap(sin(time + (i + j * offset)), -1, 0, 0, radiusSize); float radiusOuter = ofMap(sin(time + (i)*10), -1, 0, 255, outerRadiusSize); //cout<<"radius: " <<radius<< endl; //float angle = ofGetElapsedTimef(); //float angle = i; //float angle = i * (TWO_PI / 100 * 10) * time * 0.01 ; float angle = i * (TWO_PI * 0.07) * time * 0.01 ; cout<<"angle: " <<angle<< endl; ofPoint pt; ofPoint ptOuter; // Polar Equation back to coordinate point pt.x = xOrigin + radius* cos(angle); pt.y = yOrigin + radius* sin(angle); ptOuter.x = xOrigin + radiusOuter * cos(angle); ptOuter.y = yOrigin + radiusOuter * sin(angle); ofDrawCircle(pt, 1); //ofSetColor(100, 200, 100); ofDrawCircle(ptOuter, 1); //ofSetColor(225, 120, 80); // line.addVertex(pt); // if(line.size() > 2){ // line.getVertices().erase(line.getVertices().begin()); // line.draw(); // } } } }
//-------------------------------------------------------------- void ofApp::drawUi() { ofPushMatrix(); ofTranslate(GUI_WIDTH, 0); { if (isPreviewThumb) { ofSetColor(0); ofDrawRectangle(0, 0, DEPTH_WIDTH * 3, DEPTH_HEIGHT); ofSetColor(255); depthShader.begin(); { depthImage.draw(0, 0); if (testImage.isAllocated()) { testImage.draw(DEPTH_WIDTH, 0); } } depthShader.end(); filledShader.begin(); { if (testFilledImage.isAllocated()) { testFilledImage.draw(DEPTH_WIDTH * 2, 0); } } filledShader.end(); ofNoFill(); ofSetLineWidth(2); ofDrawRectangle(LINE_WIDTH / 2, LINE_WIDTH / 2, DEPTH_WIDTH - LINE_WIDTH, DEPTH_HEIGHT - LINE_WIDTH); ofDrawRectangle(LINE_WIDTH / 2 + DEPTH_WIDTH, LINE_WIDTH / 2, DEPTH_WIDTH - LINE_WIDTH, DEPTH_HEIGHT - LINE_WIDTH); ofDrawRectangle(LINE_WIDTH / 2 + DEPTH_WIDTH * 2, LINE_WIDTH / 2, DEPTH_WIDTH - LINE_WIDTH, DEPTH_HEIGHT - LINE_WIDTH); ofFill(); } if (isRecording) { ofSetColor(255, 0, 0); ofDrawCircle(40, 40, 10); ss.str(""); ss << "recording: " << takeName << "_" << ofToString(recorder.counter, 6, '0'); ofDrawBitmapString(ss.str(), 50, 40); } else if (willStopRecording) { ofSetColor(255, 0, 255); ofDrawCircle(40, 40, 10); ofDrawBitmapString("saving...", 50, 40); } else if (postProcessing.isThreadRunning()) { ofSetColor(0, 255, 0); ofDrawBitmapString("processing...", 50, 40); ofDrawRectangle(0, 0, ofGetWidth() * postProcessing.progress, 10); } } ofPopMatrix(); }
void Particle::drawBranch(float length, float theta){ float x2=150+length; float y2=(length/2)-theta; float x3=theta; float y3=100-length; //big rotating circles ofNoFill(); ofSetColor(sin(ofGetElapsedTimef()/5)*250,abs(cos(ofGetElapsedTimef()/5)*350),(sin(ofGetElapsedTimef()/3)*250),50); ofDrawCircle(x3,200,x2,y2); //small rotating circles ofNoFill(); ofSetColor(abs(tan(ofGetElapsedTimef()/5)*250),abs(tan(ofGetElapsedTimef()/5)*350),(sin(ofGetElapsedTimef()/2)*350)); ofDrawCircle(x3,length,theta*5,theta*2); //triangle // ofNoFill(); // ofSetColor(sin(ofGetElapsedTimef())*250,abs(cos(ofGetElapsedTimef()/5)*350),(sin(ofGetElapsedTimef()/3)*250),50); // ofDrawTriangle(0, 0, 10, 30, 20, 10); // //---------- ofTranslate(0, theta); ofTranslate(0, theta); length= length*0.5; theta= theta*0.8; if(length>2){ ofPushMatrix(); // ofRotate(theta/2); ofRotate(abs(cos(ofGetElapsedTimef()/4)*250)); drawBranch(length, theta); ofPopMatrix(); ofPushMatrix(); ofRotate(abs(cos(ofGetElapsedTimef()/4)*253)); drawBranch(length, theta); ofPopMatrix(); } }
void ofApp::drawCircle(float radius){ float r = ofRandomuf(); if(r > 0.95){ ofSetColor(250,126,50,150); ofDrawCircle(0, 0, radius*4); ofSetColor(0,0,0,100); ofDrawCircle(0, 0, radius); }else{ ofDrawCircle(0, 0, radius); } }
void PolyShape::debugDraw() { ofNoFill(); ofSetLineWidth(1.f); ofPushMatrix(); ofTranslate(mCenter.x, mCenter.y); ofDrawCircle(0, 0, mRadius); ofDrawCircle(0, 0, mRadius - mMaxDist); ofDrawCircle(0, 0, mRadius + mMaxDist); ofPopMatrix(); }
//----------------------------------------------------- void ofxSURFTracker::drawMatches() { for(int i = 0; i < good_matches.size(); i++) { DMatch match = good_matches[i]; int d = match.distance*500; ofSetColor(d, 0, 500 - d); Point2f p1 = keypoints_object[ good_matches[i].queryIdx ].pt; Point2f p2 = keypoints_scene[ good_matches[i].trainIdx ].pt; ofDrawLine( p1.x, p1.y, p2.x, p2.y); ofFill(); ofDrawCircle(p1.x, p1.y, 2); ofDrawCircle(p2.x, p2.y, 2); } }
//-------------------------------------------------------------- void ofApp::draw(){ // 1st, draw on screen: ofSetHexColor(0x66CC33); ofDrawRectangle(100,100,300,300); ofSetHexColor(0xffffff); ofPushMatrix(); ofTranslate(200,200,0); ofRotate(counter,0,0,1); ofDrawCircle(0,0,80); ofDrawCircle(100,0,10); // a small one ofPopMatrix(); ofSetHexColor(0x333333); ofDrawBitmapString("(a) on screen", 150,200); ofSetHexColor(0xFFCC33); ofDrawCircle(mouseX, mouseY,20); // 2nd, grab a portion of the screen into a texture // this is quicker then grabbing into an ofImage // because the transfer is done in the graphics card // as opposed to bringing pixels back to memory // note: you need to allocate the texture to the right size texScreen.loadScreenData(100,100,300,300); // finally, draw that texture on screen, how ever you want // (note: you can even draw the texture before you call loadScreenData, // in order to make some trails or feedback type effects) ofPushMatrix(); ofSetHexColor(0xffffff); ofTranslate(550,300,0); //glRotatef(counter, 0.1f, 0.03f, 0); float width = 200 + 100 * sin(counter/200.0f); float height = 200 + 100 * sin(counter/200.0f);; texScreen.draw(-width/2,-height/2,width,height); ofPopMatrix(); ofPushMatrix(); ofSetHexColor(0xffffff); ofTranslate(700,210,0); ofRotate(counter, 0.1f, 0.03f, 0); texScreen.draw(-50,-50,100,100); ofPopMatrix(); ofSetHexColor(0x333333); ofDrawBitmapString("(b) in a texture, very meta!", 500,200); }