Making my way through the Using lights recipe from the Processing 2 Creative programming cookbook source code on GitHub. In this recipe, I learned how to declare the lightMode and lightDirection integers to allow for different lighting modes to be activated. Inside the setUp function they’re assigned a value of 0 and then referenced again in the if test. In this recipe, I also learned how to use the lights, directionalLight, ambientLight, pointLight and spotLight functions for the different lighting modes, even the noLights function for a no lighting mode. This recipe contains code for generating and animating 3D primitives (first demonstrated in Drawing 3D primitives recipe) used to demonstrate the lighting setup. This…
Making my way through the Working with images recipe from the Processing 2 Creative programming cookbook source code on GitHub. In this recipe I learned how to: use the loadImage function to load an image from my data folder into my Sketch declare a boolean (pixelMode) for the if test use the image function to display the new images (dimensions specified in copWidth and copyHeight and areas specified by the pixel-swapping if test) in the window. I also learned about the get and set methods and how they can be used to define a region and change the colour of the loaded image. Rad!