To view this content, you need to install Java from java.com

Source code: three_d

Built with Processing

No. 2
three_d by paul glennon 2005

After drawing simple 2D shapes I felt it time to check out 3D primitives. Again the settings change as there is more to understand with rotation and position on screen.

I played with the settings changing the odd coordinate and watched what happened. This helped when learning how to turn the box.


//three_d by paul glennon 2005

size(300, 200, P3D);
background(0);
lights();
noStroke();
fill(150,0,255);

translate(150,100,0); //x-left/right, y-up/down, z-close to screen
rotateX(2.6); //Note the 0.0 - rotates on the x (forward roll)
rotateY(0.6); //Note the 0.0 - rotates on the x (turns right)
box(60); //size