http://www.flickr.com/photos/stopandfocus/4383824906/
Got it all sorted out finally Still a bit quirky in deb 64-bit but everything is a little quirky in Linux.
---------------------------------------------
import processing.opengl.*;
class Sphere_the_Sphere {
float sphereX=-5;
float sphereY=-5;
float sphere_rot;
void omg_silly(float sphereX,float sphereY,float sphere_rot){
this.sphereX=sphereX;
this.sphereY=sphereY;
this.sphere_rot=sphere_rot;
}
void drawsphere(){
pushMatrix();
translate(width/2,height/2);
rotateY(radians(sphere_rot));
translate(sphereX,sphereY);
sphere(3);
popMatrix();
}
}
//------------------------------------------------------------------------------
------------
int num=4000;
Sphere_the_Sphere[] ball = new Sphere_the_Sphere[num];
void setup(){
size(300,300,OPENGL);
hint(ENABLE_OPENGL_4X_SMOOTH);
for(int i=0; i<num; i++){
ball[i]=new Sphere_the_Sphere();
}
}
float height_; // this is the current height if the ellipse
float min_height=-100; // this is the ellipses lowest posible point
float max_height=100; //this is the ellipses hightest posible point
float sphereX; // this is the ellipses calculated distance from the center of the sphere
float sphereY;
float degreez=0;
float sphere_rot=0;
int i=0;
int ww=0;
//------------------------------------------------------------------------------
-------------
void draw(){
noStroke();
lights();
emissive(0, 26, 51);
background(0);
for(int dd=0;dd<num;dd++){
degreez=degreez+2.7;
if (degreez>=180){
degreez=0;
sphere_rot+=5;
// println(sphere_rot);
}
sphere_rot=sphere_rot+2.7;
if (sphere_rot>=360){
sphere_rot=0;
}
sphereY=cos(radians(degreez)); ///// these are the y values of the arc
sphereX=sin(radians(degreez)); ///// these are the x values of the arc
degreez=constrain(degreez,0,180);
sphereX=map(sphereX,-1,1,min_height,max_height);
sphereY=map(sphereY,-1,1,min_height,max_height);
if(ww<num-1){
ww++;
ball[ww].omg_silly(sphereX,sphereY,sphere_rot);
}
//-----------------------------------------------------------------------------
---
println(dd);
}
for(int zed=0 ; zed<num; zed++){
ball[zed].drawsphere();
}
println("finish");
save("spheres");
noLoop();
}
//// debug for positions of all spheres
/*
for(int ded=0 ; ded<num; ded++){
println(ball[ded].sphereX );
println(ball[ded].sphereY) ;
println(ball[ded].sphere_rot);
println("---------------------------");
}
*/