Skip to content

Instantly share code, notes, and snippets.

View andrew-dash's full-sized avatar
🛠️
building

Andrew Dash andrew-dash

🛠️
building
View GitHub Profile
vector<ofPoint> vertices;
vector<ofColor> colors;
int nTri; //The number of triangles
int nVert; //The number of the vertices equals nTri * 3
void setup() {
nTri = 1500; //The number of the triangles
nVert= nTri * 3; //The number of the vertices
float Rad = 150; //The sphere's radius
@andrew-dash
andrew-dash / imageLauncher.cpp
Created October 20, 2014 12:38
load images into an array then draw them according to key presses
// use this way of definining size to establish your array globally
#define NUM_IMAGES 4
// create an array of images
ofImage question[NUM_IMAGES];
int imgCounter;
int imgAlteration;
void setup() {
@andrew-dash
andrew-dash / imageArray.cpp
Last active August 29, 2015 14:07
Loads images into an array to easily draw many images
// use this way of definining size to establish your array globally
#define NUM_IMAGES 50
// create an array of images
ofImage question[NUM_IMAGES];
void setup() {
// put your setup code here, to run once:
@andrew-dash
andrew-dash / sineWaveSketch.cpp
Created October 15, 2014 15:51
This is Andrew's Sine Wave Sketch.
float nSamples;
void setup() {
nSamples = 10000;
// put your setup code here, to run once:
ofSetWindowShape(1000,1000);
ofBackground(120,120,120);
}
// this is the basic particle class
class Particle{
public:
ofVec2f location;
ofVec2f vel;
float color;
int dim;
ofMesh mesh; // declare mesh
ofEasyCam cam; // use a camera for 3D
void setup() {
ofEnableAlphaBlending();
ofSetWindowShape(600,400);
// set up a few verticies for the mesh
ofVec3f top(100.0, 50.0, 0.0);
ofVec3f left(50.0, 150.0, 0.0);
ofEasyCam cam;
int width, height;
int offset;
bool oneShot;
int numPoints;
// establish arrays to store values
int r[50], g[50], b[50];
float moverX[50];
@andrew-dash
andrew-dash / Particle.h
Last active August 29, 2015 14:07
ofSketch example demonstrating extending a class. This code is based off Dan Shiffman's OOPWaveParticle Example in The Nature of Code
// this is the basic particle class
class Particle{
public:
ofVec2f location;
Particle(){
@andrew-dash
andrew-dash / 3D-Grid.cpp
Created September 28, 2014 20:46
Easy 3D Grid using EasyCam and spheres for ofSketch
ofEasyCam cam;
void setup() {
ofSetWindowShape(1000,1000);
ofBackground(120,120,120);
ofEnableDepthTest();
cam.setDistance(100);
}
class Matter{
public:
ofVec2f location;
ofVec2f velocity;
ofVec2f acceleration;
ofVec2f mouse;
ofVec3f color;
float topSpeed;