It’s now useful to test out how we integrate our ESSL program with our WebGL code by taking the code from ch03_05_wall.html and making some modifications.
Imagine a wall composed of the sections A, B, and C, and you are facing section B with a flashlight in your hand (frontal view). Intuitively, you know that section A and section C will be darker than section B. This fact can be modeled by starting at the color of the center of section B and darkening the color of the surrounding pixels as we move away from the center:
Let's summarize the code we need to cover:
- The ESSL program containing the vertex and fragment shaders. For the wall, we will select Goraud shading with a Diffuse/Lambertian reflection model.
- The initProgram function. We need to make sure that we map all of the attributes and uniforms that we defined in the...