Wiki
Clarifications for Angel's Interactive Computer Graphics

Chapter 7 (Worksheet 6)
Page last edited by Jeppe Revall Frisvad (jerf) 01/10-2017

In Sec. 7.4, the Mercator projection is listed as

x = r cos(2π u)
y = r sin(2π u) cos(2π v)
z = r sin(2π u) sin(2π v).

This is not quite right as the inclination angle is in [0, π] rather than [0, 2π]. Moreover, if we have the standard WebGL coordinate system, the y-axis will be in the up direction, so a better set of formulae for the Mercator projection is

x = r sin(π u) cos(2π v)
y = r cos(π u)
z = r sin(π u) sin(2π v).

In Sec. 7.5.3, the varying vec2 created to interpolate texture coordinates across triangles is accurately defined in the vertex shader by the following line:

varying vec2 fTexCoord;

When this variable is used in the vertex shader it is mistakenly called fTexColor. This line of the vertex shader should be

fTexCoord = vTexCoord;

In the fragment shader the varying variable is mistakenly defined with the name vTexColor. It should instead be defined by the same line as in the vertex shader:

varying vec2 fTexCoord;

In the modified fragment shader line, which would be used to let the texture fully determine the color of each fragment, the name of the sampler2D variable is misprinted as texture instead of texMap. The line should be

gl_FragColor = texture2D(texMap, fTexCoord);

In Sec. 7.5.4, the following line of code has a typo

gl.tTexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER,
                          gl.NEAREST_MIPMAP_NEAREST);

It should be as follows:

gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER,
                         gl.NEAREST_MIPMAP_NEAREST);
Support: +45 45 25 74 43