July 2013
Intermediate to advanced
600 pages
15h 15m
English
All the sample programs in this book embed the shader programs in the JavaScript program, which increases the readability of the sample programs but makes it hard to construct and maintain the shader programs.
As an alternative, you can load the shader programs from files by using the same methods described in the section “Load and Display 3D Models” in Chapter 10, “Advanced Techniques.” To see how that’s done, let’s modify ColoredTriangle from Chapter 5, “Using Colors and Texture Images,” to add support for loading shaders from a file. The new program is called LoadShaderFromFiles, which is shown in Listing F.1.