Skip to content

Instantly share code, notes, and snippets.

@danbernier
Created June 30, 2015 23:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danbernier/168e8dff75b082119bae to your computer and use it in GitHub Desktop.
Save danbernier/168e8dff75b082119bae to your computer and use it in GitHub Desktop.
3D spheres
import peasy.*;
PeasyCam camera;
PVector[] spherePos;
void setup() {
size(800, 600, P3D);
camera = new PeasyCam(this, 0,0,0, 200);
setUpSpheres();
}
void setUpSpheres() {
spherePos = new PVector[10];
for (int i = 0; i < 10; i++) {
spherePos[i] = new PVector(random(100), random(100), random(100));
}
}
void draw() {
lights();
background(0);
//noStroke();
for (int i = 0; i < spherePos.length; i++) {
pushMatrix();
translate(spherePos[i].x, spherePos[i].y, spherePos[i].z);
sphere(20);
popMatrix();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment