import processing.opengl.*; int squareSize=100; float spin,tilt; PImage a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t; void setup(){ size(800,600,OPENGL); a =loadImage("1.jpg"); b =loadImage("2.jpg"); c =loadImage("3.jpg"); d =loadImage("4.jpg"); e =loadImage("5.jpg"); f =loadImage("6.jpg"); g =loadImage("7.jpg"); h =loadImage("8.jpg"); i =loadImage("9.jpg"); j =loadImage("10.jpg"); k =loadImage("11.jpg"); l =loadImage("12.jpg"); m =loadImage("13.jpg"); n =loadImage("14.jpg"); o =loadImage("15.jpg"); p =loadImage("16.jpg"); q =loadImage("17.jpg"); r =loadImage("18.jpg"); s =loadImage("19.jpg"); t =loadImage("20.jpg"); } void draw(){ background(128,128,128); fill(255,255); //noCursor(); if (mousePressed==false){ spin=radians(mouseX); } else { tilt=radians(mouseY); } rotateY(tilt); rotateX(spin); //1st row of rects pushMatrix(); translate(width/2,height/2-250,mouseY*10); smooth(); //rotate(PI/5); image(a,squareSize,squareSize); translate(0,0,-200); image(b,squareSize,squareSize); translate(0,0,-400); image(c,squareSize,squareSize); translate(0,0,-600); image(d,squareSize,squareSize); translate(0,0,-800); image(e,squareSize,squareSize); translate(0,0,-1000); image(f,squareSize,squareSize); translate(0,0,0); image(g,squareSize,squareSize); popMatrix(); //2nd row of rects top left pushMatrix(); translate(width/2-350,height/2,mouseY*10); smooth(); //rotate(PI/5); image(h,squareSize,squareSize); translate(0,0,-200); image(i,squareSize,squareSize); translate(0,0,-400); image(j,squareSize,squareSize); translate(0,0,-600); image(k,squareSize,squareSize); translate(0,0,-800); image(l,squareSize,squareSize); translate(0,0,-1000); image(m,squareSize,squareSize); translate(0,0,0); image(n,squareSize,squareSize); popMatrix(); //3rd row of rects pushMatrix(); translate(width/2,height/2,mouseY*10); smooth(); //rotate(PI/5); image(o,squareSize,squareSize); translate(0,0,-200); image(p,squareSize,squareSize); translate(0,0,-400); image(q,squareSize,squareSize); translate(0,0,-600); image(r,squareSize,squareSize); translate(0,0,-800); image(s,squareSize,squareSize); translate(0,0,-1000); image(t,squareSize,squareSize); translate(0,0,0); image(c,squareSize,squareSize); popMatrix(); //4th row of rects bottom right pushMatrix(); translate(width/2-350,height/2-250,mouseY*10); smooth(); //rotate(PI/5); image(f,squareSize,squareSize); translate(0,0,-200); image(j,squareSize,squareSize); translate(0,0,-400); image(m,squareSize,squareSize); translate(0,0,-600); image(e,squareSize,squareSize); translate(0,0,-800); image(h,squareSize,squareSize); translate(0,0,-1000); image(c,squareSize,squareSize); translate(0,0,0); image(p,squareSize,squareSize); rectMode(CENTER); popMatrix(); }