After many episodes of 2D graphics we find out how to draw things on 3D. It's actually very simple. We call the box() function to draw a 3D cube. We send just one parameter to box() to indicate the size of the box. To place the cube somewhere in the screen we use translate(). It's not the first time we use translate, but it is the first time we use it with three parameters. The third parameter indicates the depth, or how close to you or far away from you is the cube. This third parameter is called Z. If Z is positive, the object is closer to you. Making that value smaller, even negative, will bring the cube away from you.
Using the box() function will not work if you don't change the current renderer. By default, Processing wants to draw only 2D. To switch to 3D mode, you can add a third parameter when you call size, for example size(400, 400, P3D); The P3D part is telling Processing you want to do 3D graphics.
Once you get used to using translate() to move the cube around, try using rotateX(), rotateY() and rotateZ() to make the cube rotate around different axes.

Loading more stuff…

Hmm…it looks like things are taking a while to load. Try again?

Loading videos…