Some WEBGL functions

Tests the WEBGL functions ambientLight, pointLight, ambientMaterial, emisiveMaterial, specularMaterial, and specularColor.

These examples are from the https://p5js.org/reference/#/p5/ambientMaterial, https://p5js.org/reference/#/p5/emissiveMaterial, https://p5js.org/reference/#/p5/specularColor, and https://p5js.org/reference/#/p5/emissiveMaterial https://p5js.org/reference/#/p5/spotLight reference pages.

The third example has an extra. By default, the ambientMaterial on the box does not reflect the green light. A green light is used in this example and by default the surface reflects no green light meaning it shows up being black. The slider allows you to change the green ambient material value of that surface.

Several functions have 3 or 4 color parameters. These parameters had to be processed before they could be used in the same way that they have to be processed for background, fill, and stroke. Otherwise implimenting these functions was easy and routine (except for pointLight).

It needs to be noted that except for the 3rd canvas in the first row, all the canvases were set up statically in setup(). It was determined that either the light or material wore out during repeated drawings when the same code was executed in draw(). That is, the sphere just turned white after a few drawings.

The p5js code: ambient.pjs

James Brink, 8/1/2020