Advertisement
Errata - 1st Edition PDF Print E-mail
Written by Administrator   
Saturday, 02 June 2007

Many of these errors were corrected in the second printing of the first edition. All of them were corrected for the second edition of the book.

Embarassed

  • p. 27 — 3rd paragraph, second to last line, should be glCopyTexImage1D/2D, not glCopyTexImage1D/2D/3D
  • p. 57 — 7th entry in the "New entry points" list should be glGetAttribLocation, not glGetVertexAttribLocation
  • p. 74 — The nested structure in the middle of the page should be defined as shown below (the example that appears in the book will generate a syntax error because lightColor is in the wrong place):
       struct light
    {
    vec4 position;
    struct
    {
    vec3 color;
    float intensity;
    } lightColor;
    } light1 = light(v, lightColor(color, 0.9));
  • p. 113 — In the second line of code in Section 4.5.5, the built-in variable should be gl_ModelViewProjectionMatrix instead of gl_ModelViewProjectMatrix.
  • pp. 132,133 — All occurrences of matrixcompmult should be matrixCompMult.
  • p. 160 — 1st paragraph, 3rd line of Section 7.1, change "source code source code..." to "source code. The source code..."
  • p. 161 — For glShaderSourceARB, the nstrings argument should be type GLsizei, not GLuint. The type of the lengths argument should be const GLint *, not GLint *. These parameters are defined correctly on the reference page for glShaderSourceARB on p. 486.
  • p. 170 — last paragraph, 4th line, change "count" to "length"
  • p. 189 — The nested structure near the top of the page should be defined as shown below (the example that appears in the book will generate a syntax error because uniform is in the wrong place):
    uniform struct
    {
    struct
    {
    float a;
    float b[10];
    } c[2];
    vec2 d;
    } e;
  • p. 218— I incorrectly assumed that the directions for directional light sources would be stored as normalized values. This turns out to be incorrect. Therefore the computation for nDotVP requires normalization of the light source direction vector (which is stored in the position field of the structure. The computation in Listing 9.6 should be:
       nDotVP = max(0.0, dot(normal, 
    normalize(vec3 (gl_LightSource[i].position))));
  • p. 219 — 3rd paragraph, last sentence, change "except that the diffuse and specular terms..." to "except that the ambient, diffuse, and specular terms...".
  • p. 220— Computation of the final value for ambient should be:
       ambient += gl_LightSource[i].ambient * attenuation;
  • p. 221— I incorrectly assumed that the directions for spot light sources would be stored as normalized values. This turns out to be incorrect. Therefore the computation for spotDot requires normalization of the light source direction vector (which is stored in the position field of the structure. The computation in Listing 9.8 should be:
       spotDot = dot(-VP, normalize(gl_LightSource[i].spotDirection));
  • p. 222— Computation of the final value for ambient should be:
       ambient += gl_LightSource[i].ambient * attenuation;
  • p. 246 — 1st paragraph, second sentence, change "less than" to "equal to". Also change the sentence that begins "We use conditional statements to use..." to "The color value will end up being the computed daytime value in the sunlit areas, the computed nighttime value in the areas in shadow, and a mix of the two values to make a gradual transition near the terminator."
  • p. 246 — The first statement in the main function of Listing 10.4 should be:
      vec2 clouds = texture2D(EarthCloudGloss, TexCoord).rg;
    (This is a code readability issue only, functionally, it is the same. But we should use .rg because we are treating the returned values as colors, not a texture coordinate. Similarly for the next two changes.)
  • p. 246 — The second statement in the main function in Listing 10.4 (setting of daytime variable) should have the .stp changed to .rgb. I.e.,
      vec3 daytime = (texture2D(EarthDay, TexCoord).rgb * Diffuse +
    Specular * clouds.g) * (1.0 - clouds.r) +
    clouds.r * Diffuse;
  • p. 246 — The third statement in the main function in Listing 10.4 (setting of nighttime variable) should have the .stp changed to .rgb, and the value should be multiplied by 2.0. I.e.,

     

       vec3 nighttime = texture2D(EarthNight, TexCoord).rgb *
    (1.0 - clouds.r) * 2.0;
  • p. 247 — The first conditional test in Listing 10.4 can be removed, since it is not possible for Diffuse to be less than 0.0. I.e., delete the lines of code that read:
       if (Diffuse < -0.1)
    color = nighttime;
  • p. 247 — The second conditional test in Listing 10.4 can have the abs() function call removed, since it is not possible for Diffuse to be less than 0.0. . I.e., the lines should read:
       if (Diffuse < 0.1)
    color = mix(nighttime, daytime, (Diffuse + 0.1) * 5.0);
  • p. 248 — 1st paragraph, change 180 to 90 and change -180 to -90.
  • p. 250— Components of index in Listing 10.6 should be accessed with s and t, since this variable is used as a texture coordinate. I.e., change the third and fifth lines of code to:
        index.t = dot(normalize(reflectDir), Yunitvec);
    index.s = dot(normalize(reflectDir), Xunitvec) * 0.5;
  • p. 278 — 1st line of code, comment should be "= -3.0", not "= -3"
  • p. 278 — 2nd line of code, comment should be "= 0.3", not "= 0.4"
  • p. 285 — 4th paragraph, 5th line, "transforms the object space light direction..." should be "transforms the eye space light direction..."
  • p. 326 — 3rd paragraph, should be "9.8 meters per second per second" instead of "9.8 meters per second"
  • p. 344 — last line of code should be:
       gl_FragColor = vec4 (vec3 (square), 1.0) * LightIntensity;
  • p. 412 — 3rd paragraph, 2nd sentence is incorrect. It should say, "The translation is done to a binary representation of assembly code. This binary representation may still need to be translated to native machine code at run-time."
Last Updated ( Saturday, 02 June 2007 )
 
thinkorange09.jpg