Architectural updates

Let's review the structure of the examples developed in the book. Each web page includes several scripts. One of them is WebGLApp.js. This script contains the WebGLApp object.

WebGLApp review

The WebGLApp object defines three function hooks that control the life cycle of the application. As shown in the diagram, we create a WebGLApp instance inside the runWebGLApp function. Then, we connect the WebGLApp hooks to the configure, load, and draw functions that we coded. Also, please notice that the runWebGLApp function is the entry point for the application and it is automatically invoked using the onload event of the web page.

Adding support for matrix stacks

The diagram also shows a new script: SceneTransforms.js. This file contains ...

Get WebGL Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.