int i = 0; float mx; float my; float mfx; float mfy; float deltax = 0; float deltay = 0; void setup() { size(800, 800, P3D); background(200); lights(); //translate(height/2, width/2 , 0); sphereDetail(9); sphere(height/4); frameRate(2); } void draw() { pushMatrix(); i=(i+1)%16; translate (height/2, width/2 , 0); rotateY(deltay*PI/64); rotateX(deltax*PI/64); sphereDetail(9); background(200); lights(); rect (height/4,width/4,1.5*height/4,1.5*width/4); noStroke(); //translate(height/2, width/2 , 0); sphere(height/4); popMatrix(); } void mousePressed() { pushMatrix(); translate (height/2, width/2 , 0); mx=mouseX; my=mouseY; popMatrix(); } void mouseDragged() { pushMatrix(); translate (height/2, width/2 , 0); mfx=mouseX; mfy=mouseY; deltay = (mfx-mx)%128; deltax = (my - mfy)%128; popMatrix(); }