Code Downloads & Errata

If you have purchased a Packt book and/or video, you can use this page to
  • Download the code or support files
  • View errata and amendments
  • Send us feedback

You selected

WebGL Beginner's Guide

Diego Cantor

Published 2012-06-15

Downloads

Please register your e-mail address to download files. We will e-mail you with a direct link to the code download. If you have bought this book, you can login to your account and download the code files from your account page.

Before downloading the files please tell us where you purchased this book.

Errata

- 5 submitted: last submission 21 Apr 2017

Errata type: Code | Page number: 78

The color picker now remember the last color selected. Also the Lambert sphere exercise has been updated with the missing y-axis slider.
The updated working exercises can be found at WebGL Beginner’s Guide – Examples.
The repository with the source code has been updated at Download the source code.

 

Errata type: Code | Page number:80

The code line

gl.uniform3f(prg.uLightDirection, 0.0, 0.0, -1.0)

in step 7 of page 80, should be

gl.uniform3f(prg.uLightDirection, 0.0, -1.0, -1.0)

Errata type: Code | Page number: 96

The code has been updated in the BitBucket repository, at:

http://bitbucket.org/dcantor/webgl-beginner's-guide-code

 

The code example has been updated at:

http://voxelent.com/html/beginner's-guide/1727_03/ch_3_Wall_Final.html

 

Errata Type : Technical | Page number: 61

In the Normals section for calculating the normals the Vector values for v1 and v2 in the explanation have been mentioned incorrectly. The values vector v1 should be p1 - p0 and v2 should be p2 - p0. 

Errata typr: Technical   |  Page number: 62

The line is:

For example, say that the vertex p1 is being shared by triangles #1 and #2

The line should be:

For example, say that the vertex p0 is being shared by triangles #1 and #2

 

Errata Type: Typo | Page: 85

It is:

Unlike the Lambertian reflection model, the Goraud lighting model ...

Should be:
Unlike the Lambertian reflection model, the Phong reflection model ...

 

Errata Type: Technical | Page: 141

It is:

The predefined variable, gl_Position , stores the NDC coordinates for each vertex of every object defined in the scene. 

Should be:

The predefined variable, gl_Position , stores the clip-space coordinates for each vertex of every object defined in the scene. 

 

Page 115 must read [keeping the italics]:
3. The Perspective matrix implements the projection transformation. Multiplying vertices in view coordinates by this matrix produces vertices in clip coordinates. After perspective division, vertices will be in normalized device coordinates (NDC).
The text on page 140 under Have a go hero, must read:
Remember that once we have multiplied vertices by Model-View matrix, the next step is to obtain vertices in clip coordinates: