summaryrefslogtreecommitdiff
path: root/testpoints/src
diff options
context:
space:
mode:
authorComment <tim@gray.(none)>2013-06-24 23:18:03 +0100
committerComment <tim@gray.(none)>2013-06-24 23:18:03 +0100
commit11229ede83c48fab01e6e566155536b5e7e9d762 (patch)
treedcd2671c419bdbddde9191712dc3cf5ab2a98f04 /testpoints/src
parentff979a86dc8f031c823cd8806324b0e8c4ca069b (diff)
yay
Diffstat (limited to 'testpoints/src')
-rw-r--r--testpoints/src/main.cpp18
-rw-r--r--testpoints/src/testApp.cpp88
-rw-r--r--testpoints/src/testApp.h33
3 files changed, 139 insertions, 0 deletions
diff --git a/testpoints/src/main.cpp b/testpoints/src/main.cpp
new file mode 100644
index 0000000..cfae893
--- /dev/null
+++ b/testpoints/src/main.cpp
@@ -0,0 +1,18 @@
+#include "ofMain.h"
+#include "testApp.h"
+
+//========================================================================
+int main( ){
+
+ //ofSetupOpenGL(4080,768, OF_WINDOW); // <-------- setup the GL context
+ ofSetupOpenGL(800,600, OF_WINDOW); // <-------- setup the GL context
+
+
+
+ // this kicks off the running of my app
+ // can be OF_WINDOW or OF_FULLSCREEN
+ // pass in width and height too:
+
+ ofRunApp(new testApp);
+
+}
diff --git a/testpoints/src/testApp.cpp b/testpoints/src/testApp.cpp
new file mode 100644
index 0000000..c62dcf3
--- /dev/null
+++ b/testpoints/src/testApp.cpp
@@ -0,0 +1,88 @@
+#include "testApp.h"
+
+ /*
+ maybe draw pixel lines to a range of buffers and then play them in various 3D directions
+ pixel lines can have nice, missing corners and be nicely smoothed
+
+ is it insane not to do this in vvvv
+
+ can there be an editing interface
+
+ have a play with vvvv/ max and try to replicate this idea QUICKLY?
+ */
+
+
+//--------------------------------------------------------------
+void testApp::setup(){
+
+
+}
+
+
+
+//--------------------------------------------------------------
+void testApp::update(){
+ ofBackground(0,0,0);
+ for (int i=0;i<10;i++){
+ points.push_back(ofPoint(ofRandom(ofGetWidth()),ofRandom(ofGetWidth()),ofRandom(ofGetWidth())));
+ speeds.push_back(ofPoint(ofRandom(10)-5,ofRandom(10)-5,ofRandom(10)-5));
+ colours.push_back(ofColor(ofRandom(127)+128,ofRandom(127)+128,ofRandom(127)+128));
+ sizes.push_back(ofRandom(6)+1);
+ }
+}
+
+//--------------------------------------------------------------
+void testApp::draw(){
+ //glEnable(GL_PROGRAM_POINT_SIZE);
+ //glEnable(GL_POINT_SMOOTH);
+ //glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
+ glEnable( GL_BLEND );
+ glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+ ofPushMatrix();
+ ofTranslate(ofGetWidth()/2,ofGetHeight()/2,ofGetHeight()/2);
+
+ for (int i=0;i<points.size();i++){
+ points[i]+=speeds[i];
+ speeds[i]-=points[i]*.01;
+ glPointSize(sizes[i]);
+ glBegin(GL_POINTS);
+ glColor3ub(colours[i].r,colours[i].g,colours[i].b);
+ glVertex3f(points[i].x,points[i].y,points[i].z);
+ glEnd();
+ }
+
+ //glDisable( GL_BLEND );
+ //glDisable(GL_PROGRAM_POINT_SIZE);
+ ofPopMatrix();
+ string msg=ofToString(ofGetFrameRate(), 2);
+ msg+="\n"+ofToString(points.size());
+ ofDrawBitmapString(msg,20,20);
+}
+
+
+//--------------------------------------------------------------
+void testApp::keyPressed (int key){
+
+
+}
+
+//--------------------------------------------------------------
+void testApp::mouseMoved(int x, int y ){
+
+}
+
+//--------------------------------------------------------------
+void testApp::mouseDragged(int x, int y, int button){
+
+}
+
+//--------------------------------------------------------------
+void testApp::mousePressed(int x, int y, int button){
+
+}
+
+//--------------------------------------------------------------
+void testApp::mouseReleased(){
+
+}
+
diff --git a/testpoints/src/testApp.h b/testpoints/src/testApp.h
new file mode 100644
index 0000000..7b0c226
--- /dev/null
+++ b/testpoints/src/testApp.h
@@ -0,0 +1,33 @@
+#ifndef _TEST_APP
+#define _TEST_APP
+
+#include "ofMain.h"
+
+
+class testApp : public ofBaseApp{
+
+ public:
+
+ void setup();
+ void update();
+ void draw();
+
+ void keyPressed (int key);
+ void mouseMoved(int x, int y );
+ void mouseDragged(int x, int y, int button);
+ void mousePressed(int x, int y, int button);
+ void mouseReleased();
+
+
+ private:
+
+ vector<ofPoint> points;
+ vector<ofPoint> speeds;
+ vector<ofColor> colours;
+ vector<float> sizes;
+
+};
+
+#endif
+
+