WebGL Textures & Vertices
Page Twenty Nine
Procedural Textures Properties
GLEntity Details section, explains
how to prepare textures from image files
Procedural textures require two modifications
to the texture initialization process.
First the WebGL method
has two overloads. The simpler
overload applies to image files.
Image objects maintain width and
overload which applies to procedural
textures requires width and height parameters
in the method call.
Second the book's
class initializes textures after an
image downloads, with the method
We can call
directly to prepare a texture from a
The following diagram
provides an overview of the sequence of events to initialize
WebGLTexture from a
procedurally generated data.
First select a texture from the Web page's drop down menu.
The selection calls a method to fill a
with color data.
Second call the
setImage(ev). Pass a reference
of the controller as the only parameter.
calls the overloaded version of the WebGL method
The rest of the method calls are covered in the
Finalize then Display the Mesh.
Diagram 9: Procedural Texture Diagram
nImagesToLoad == 0 then
GLEntity calls the overloaded version
With procedural textures, we don't need to
load an image.
Overloaded means the same method
can receive a different number of parameters.
In the section titled
Load the Image File,
we demonstrate calling
with six parameters.
with nine parameters to
properly initialize procedural textures.