summaryrefslogtreecommitdiff
path: root/testpoints/src/testApp.cpp
blob: c62dcf3024e18bdecabc3b18ab907112b73c1cd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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(){

}