Created
November 17, 2014 00:46
-
-
Save kylemcdonald/0548cd9b02705ccd2649 to your computer and use it in GitHub Desktop.
Hairball in openFrameworks.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ofMain.h" | |
class ofApp : public ofBaseApp { | |
public: | |
ofEasyCam cam; | |
vector<ofVec3f> vertices; | |
ofVboMesh mesh; | |
void setup() { | |
ofSetVerticalSync(false); | |
int n = 250; | |
for(int i = 0; i < n; i++) { | |
ofVec3f v(ofRandom(50, 250), 0, 0); | |
v.rotate(ofRandom(360), ofRandom(360), ofRandom(360)); | |
vertices.push_back(v); | |
} | |
for(int i = 0; i < n; i++) { | |
for(int j = 0; j < n; j++) { | |
mesh.addVertex(vertices[i]); | |
mesh.addVertex(vertices[j]); | |
} | |
} | |
ofLog() << mesh.getNumVertices() / 2; | |
mesh.setMode(OF_PRIMITIVE_LINES); | |
ofBackground(0); | |
} | |
void draw() { | |
ofSetColor(255, 2); | |
cam.begin(); | |
ofRotateY(ofGetElapsedTimef() * 90); | |
mesh.draw(); | |
cam.end(); | |
ofSetColor(255); | |
ofDrawBitmapString(ofToString((int) ofGetFrameRate()), 10, 20); | |
} | |
}; | |
int main() { | |
ofSetupOpenGL(1280, 720, OF_WINDOW); | |
ofRunApp(new ofApp()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment