//------------------------------------------------------------------------------ void ofApp::draw() { ofBackground(0); float centerX = ofGetWidth() / 2; float centerY = ofGetHeight() / 2; ofPushMatrix(); ofTranslate(centerX,centerY); // create a new origin @ centerX, centerY ofEllipse(0,0,10,10); ofRotateZDeg(angleDegrees); ofLine(0,0,radius,0); // this push matrix will inherit the existing transformations ofPushMatrix(); ofTranslate(radius,0); ofEllipse(0,0,10,10); ofRotateZDeg(angleDegrees); ofLine(0,0,radius,0); ofPushMatrix(); ofTranslate(radius,0); ofScale(scaleX,scaleY); ofEllipse(0,0,10,10); ofPopMatrix(); ofPopMatrix(); ofPopMatrix(); }
void draw() { ofPushMatrix(); float screenWidth = config["screen"]["width"]; float screenHeight = config["screen"]["height"]; float camWidth = config["camera"]["width"]; float camHeight = config["camera"]["height"]; ofTranslate(screenWidth / 2, screenHeight / 2); ofRotateZDeg(config["camera"]["rotate"]); ofTranslate(-camWidth / 2, -camHeight / 2); if(cam->isInitialized()) { cam->draw(0,0); } clipping.draw(0, 0); ofPopMatrix(); if(cam->isInitialized()) { drawHistogram(cam->getPixels(), mouseY); } }
//-------------------------------------------------------------- void ofApp::draw(){ ofBackground(0, 0, 0); float movementSpeed = .1; float cloudSize = ofGetWidth() / 2; float maxBoxSize = 100; float spacing = 1; int boxCount = 100; cam.begin(); for(int i = 0; i < boxCount; i++) { ofPushMatrix(); float t = (ofGetElapsedTimef() + i * spacing) * movementSpeed; ofVec3f pos( ofSignedNoise(t, 0, 0), ofSignedNoise(0, t, 0), ofSignedNoise(0, 0, t)); float boxSize = maxBoxSize * ofNoise(pos.x, pos.y, pos.z); pos *= cloudSize; ofTranslate(pos); ofRotateXDeg(pos.x); ofRotateYDeg(pos.y); ofRotateZDeg(pos.z); ofLogo.bind(); ofFill(); ofSetColor(255); ofDrawBox(boxSize); ofLogo.unbind(); ofNoFill(); ofSetColor(ofColor::fromHsb(sinf(t) * 128 + 128, 255, 255)); ofDrawBox(boxSize * 1.1f); ofPopMatrix(); } cam.end(); }
//-------------------------------------------------------------- void ofApp::draw() { ofBackground(255,0); ofSetColor(255); ofPushMatrix(); ofTranslate(ofGetWidth()/2.0f,ofGetHeight()/2.0f); ofRotateZDeg(angle); ofEnableAlphaBlending(); rpiLogo.draw(-rpiLogo.getWidth()/2.0f,-rpiLogo.getHeight()/2.0f); ofDisableAlphaBlending(); ofPopMatrix(); // draw the mouse ofPushStyle(); ofSetColor(255,0,0); ofNoFill(); ofDrawLine(ofGetMouseX(),0,ofGetMouseX(),ofGetHeight()); ofDrawLine(0,ofGetMouseY(),ofGetWidth(),ofGetMouseY()); ofPopStyle(); }
//-------------------------------------------------------------- void ofApp::draw() { ofSetColor(50); ofPushMatrix(); ofTranslate(ofGetWidth()/2, ofGetHeight()/2); float radius = 350; for(unsigned int i=0; i<words.size()/2; i++) { float t = -HALF_PI + ofMap(i, 0, (words.size()/2), 0, TWO_PI); float x = cos( t ) * radius; float y = sin( t ) * radius; float a = ofRadToDeg(atan2(y, x)); ofSetColor(0); ofPushMatrix(); ofTranslate(x, y); ofRotateZDeg(a); float scl = 1; glScalef(scl, scl, scl); font.drawString(words[i].word, 0, 20); ofPopMatrix(); } ofSetColor(100); font.drawString(sortTypeInfo, -(font.stringWidth(sortTypeInfo)/2), 0); ofPopMatrix(); // instruction ofSetColor(10); ofDrawBitmapString("\nPress 1 for no sort\nPress 2 for alphabetical\nPress 3 for word length\nPress 4 for word occurrence", 20, 20); }
//-------------------------------------------------------------- void ofApp::draw(){ ofSetColor(225); verdana14.drawString("Font Example - use keyboard to type", 30, 35); ofSetColor(245, 58, 135); verdana14.drawString("anti aliased", 155, 92); verdana14.drawString("anti aliased", 155, 195); verdana14A.drawString("aliased", 545, 92); ofSetColor(225); verdana14.drawString("verdana 14pt - ", 30, 92); verdana14.drawString(typeStr, 30, 111); verdana14A.drawString("verdana 14pt - ", 422, 92); ofDrawRectangle(420, 97, 292, 62); ofSetColor(54, 54, 54); verdana14A.drawString(typeStr, 422, 111); ofSetColor(29,29,29); ofDrawLine(30, 169, ofGetWidth()-4, 169); ofSetColor(225); verdana14.drawString("verdana 30pt - ", 30, 195); verdana30.drawString(typeStr, 30, 229); ofSetColor(29,29,29); ofDrawLine(30, 312, ofGetWidth()-4, 312); ofSetColor(245, 58, 135); franklinBook14.drawString("anti aliased", 169, 338); franklinBook14A.drawString("aliased", 560, 338); ofSetColor(225); franklinBook14.drawString("franklin book 14pt - ", 30, 338); franklinBook14.drawString(typeStr, 30, 358); franklinBook14A.drawString("franklin book 14pt - ", 422, 338); ofDrawRectangle(420, 345, 292, 62); ofSetColor(54, 54, 54); franklinBook14A.drawString(typeStr, 422, 358); ofSetColor(29,29,29); ofDrawLine(30, 418, ofGetWidth()-4, 418); ofSetColor(225); verdana14.drawString("ROTATION", 30, 445); verdana14.drawString("SCALE", 422, 445); ofPushMatrix(); string rotZ = "Rotate Z"; ofRectangle bounds = verdana30.getStringBoundingBox(rotZ, 0, 0); ofTranslate(110 + bounds.width/2, 500 + bounds.height / 2, 0); ofRotateZDeg(ofGetElapsedTimef() * -30.0); verdana30.drawString(rotZ, -bounds.width/2, bounds.height/2 ); ofPopMatrix(); ofPushMatrix(); string scaleAA = "SCALE AA"; bounds = verdana14.getStringBoundingBox(scaleAA, 0, 0); ofTranslate(500 + bounds.width/2, 480 + bounds.height / 2, 0); ofScale(2.0 + sin(ofGetElapsedTimef()), 2.0 + sin(ofGetElapsedTimef()), 1.0); verdana14.drawString(scaleAA, -bounds.width/2, bounds.height/2 ); ofPopMatrix(); ofPushMatrix(); string scaleA = "SCALE ALIASED"; bounds = verdana14A.getStringBoundingBox(scaleA, 0, 0); ofTranslate(500 + bounds.width/2, 530 + bounds.height / 2, 0); ofScale(2.0 + cos(ofGetElapsedTimef()), 2.0 + cos(ofGetElapsedTimef()), 1.0); verdana14A.drawString(scaleA, -bounds.width/2, bounds.height/2 ); ofPopMatrix(); }