WebGL Textures & Vertices

Beginner's Guide

Page Eighty

Successful WebGL Program

If the program validation was successful then call any final initialization sequence required for the specific project. If an example project requires unique settings before rendering, then the project implements a method named init(controller). The parameter to init(controller) is a reference to GLControl. The Display Repeating Graphic project implements an init(controller) method. Other books in the series implement special features to initialize before rendering. We demonstrate the call to init(controller) in the this book, as a foundation for future projects. The following listing calls init(controller), if it's defined. The glDemo variable generically references any project in the series.

if (glDemo.init != null){
 glDemo.init(controller);
}

Listing 81: Unique Initialization For a Project

Everything's ready to render the scene. See the source code for method setProgramVariables().

WebGL Beginner's Guide Introduction WebGL Beginner's Guide
Copyright © 2015 Seven Thunder Software. All Rights Reserved.