Let's cover some useful functions that we can refactor to use in later chapters:
- We've seen how to create and compile a program using shaders. We've also covered how to load and reference attributes and uniforms. Let's include a module that abstracts away this low-level functionality with a simpler API:
<script type="text/javascript" src="/common/js/Program.js"></script>
- Like we did previously, we will include this script tag in the <head> of the HTML document. Be sure to include it after the other module scripts, since they may use the libraries and earlier modules we've covered.
- Let's update our initProgram function inside of ch03_08_showroom.html so that we can use this module:
function initProgram() {
const canvas = document.getElementById('webgl-canvas');
utils.autoResizeCanvas...