OpenGL Programming Guide 8th Edition ERRATA I'm writing down here the typos and errors I find in the book as I read it. This is still work in progress. If you want to add something to this list, send me an email: fjabad@dsic.upv.es Note: I'm not related to the authors of this book. Paco Abad. IMPORTANT: --------- p.17 Vertex-Array Objects deserve a more thorough explanation, since it is an important concept in OpenGL. See for example: http://www.opengl.org/wiki/Vertex_Specification#Vertex_Array_Object p.88 glLineWidth is deprecated (not removed yet), and any width value greater than 1.0 will generate a GL_INVALID_ERROR (see D.2.1 of OpenGL 4.3 core specification) p. 91 The ability to use different modes for different faces of a polygon (with glPolygonMode) has been removed (see D.2.2 of OpenGL 4.3 core specification) p.109 and 110 The equations for normalization of signed and unsigned integers values are reversed. The example in p.110 for the number 4 is using the wrong equation. GL_INT is signed, so it should be: f = (2*4+1)/(2^32-1), which results in: 0.0000000021 p.115, Note The static vertex attribute values are *not* stored in VAO. They are stored in the current state, and they might be shared by different programs (see http://www.opengl.org/sdk/docs/man/xhtml/glVertexAttrib.xml) p. 123, p.126 The creation and binding of the VAO should be placed before setting the element array buffer, to record that binding into the VAO. Then, in p. 127 it wouldn't be necessary to bind the GL_ELEMENT_ARRAY_BUFFER after binding the VAO p.126 The indices and the vertices in the source code do not match with those in Figure 3.7 p.196 At the end of the box: glDrawBuffers also accept GL_NONE and GL_COLOR_ATTACHMENTi for user-defined FBOs p.226 The signs of the sines in the rotation matrix about Y are reversed (the sine in the fist row should be positive, and the sine in the third row should be negative) p.228, 229, 231 The matrices for the perspective and orthographic projections are wrong (the good ones are defined in the vmath.h file in the provided code, or in the OpenGL 2.1 references pages. See, for example http://www.opengl.org/sdk/docs/man2/xhtml/glFrustum.xml). This section is a little bit of a mess, because it is assuming that the view volume is in the positive Z space of a left-handed coordinate system, when the matrices are designed for a right-handed CS, with the camera looking along the -Z. For example, if we transform the vertex (-width/2, -height/2, znear, 1) using the matrix in page 228, we would expect to get (-1, -1, -1, 1), but we get (1, 1, -1, 1) p.229 Last paragraph, and the box for vmath::lookAt: lookAt does not return a projection matrix. It is used just for placing and orienting the camera. p.233-234 In all the examples, the usual transformation matrices order (Projection * View * Model) has been changed to something else (P * M * V, in p. 233, and V * M * P in p. 234) p.402 In the call to glFrameBufferTexture(GL_FRAMEBUFFER,...) the second argument should be GL_DEPTH_ATTACHMENT, since the texture depth_texture has no stencil. p. 406 In the Example 7.20, the normal is passed to the fragment shader in Eye space, while the fragment shader in Example 7.21 multiplies it by the vector L, defined in world space. p. 490 gl_PatchVerticesOut does not exists. Remove from Table 9.1 and from the text. p.492 In the figure, the indices of gl_TessLevelInner are changed (0 controls the horizontal partitioning, and 1 the vertical) In Example 9.3, gl_TessLevelOuter[3] should be 4.0 In Example 9.3, gl_TessLevelInner[0] should be 4.0 and gl_TessLevelInner[1] should be 3.0 to match with Figure 9.1 p. 496 The caption of Figure 9.4 is reversed with respect the examples in the figure It would be nice to provide the specific outer and inner levels of the examples, since they don't appear anywhere in the text p. 498. Table 9.3, In the fractional_even_spacing and fractional_odd_spacing, the two segments that may be shorter than the others can be located anywhere, not only at the end. They should be placed symmetrically on opposite sides of the edge. p. 498 In the example of the layout, points should be point_mode p. 508 Example 9.13: p is displaced by texture(DisplacementMap, gl_TessCoord.xy); That means that we can only displace p up to one unit in the positive direction of the main axis (not two units, nor -0.5 units) p.517 In both definitions of the interface block, remove "out" from the members of the block p. 628 In both boxes defining glDispatchCompute and glDispatchComputeIndirect: the constant to find the maximum number of groups that can be dispatched is GL_MAX_COMPUTE_WORK_GROUP_COUNT p. 630 First paragraph. For querying the size of the local group, we should use the constant GL_COMPUTE_WORK_GROUP_SIZE MINOR: ----- Across the book: The "C" language does not exists. C does. p.14 line 7: 'rending' -> 'rendering' p.18 line 3: [...] but it may *not* be immediately intuitive p.21 line 10 of the box for glBufferData: OpenGL*semicolor*GL_COPY_READ_BUFFER p.22 line -17: draw geometric primitives into *this* coordinate space. p23 line 2: remove one "OpenGL Shading Language" p.24 second bullet point: [...] which is vPosition**'s** line -4: [...] which shader stage it*'*s used for p.26 In the box for glVertexAttribPointer, glVertexAttribFourN* should be glVertexAttrib4N*. Also this function has not been introduced, so there is no point in using it to clarify a concept. p.27 Next-to-last paragraph: While there *is* a long history... p. 92 line -15: the polygon corresponding to that *area* is considered p.118 The definition of glDrawArraysIndirect says that "Behaves exactly as glDrawArraysInstanced", but that function is not explained until 10 pages later. The same goes for glDrawElementsIndirect. I think they should be pushed back, or include a reference to the page where those functions are explained p.119 By the middle of the page, a sentence starts with "firstVertex is used, along...", where firstVertex is not defined. p.120, 121 In the explanation in the box for glMultiDrawElements and glMultiDrawElementsBaseVertex, 'first' should be 'count' p.121 Remove the '\' in the definition of the parameter baseVertex in the code that explains the meaning of glMultiDrawElementsBaseVertex p.121 Inside of the loop, glDrawElements should be glDrawElementsBaseVertex (the parameters are OK) p.122 and 123 Review the comments for variables vertex_positions and vertex_indices p.125 restating -> restarting p.125 Title of Example 3.7 Intializing -> Initializing p.127 Match the format of #endif with that of #if p.130 Write the equation \frac{instance}{divisor} as \floor*{\frac{instance}{divisor}} p.136 The text starts talking about Texture Buffer Objects without explaining what it is. There should be at least a reference to the page where they are explained p.139 At the end, put a ',' between glDrawArraysInstanced() and glDrawElementsInstanced() p.142 4th bullet point, 'modfies' -> modifies p. 146 Section Stencil Buffer: circular reference: it refers to itself for further discussion (maybe it should refer to the Section "Stencil Test", in p. 159 p.151 In the definition of VertexData, the array position's size should be 2 instead of 4 p.163 In the description of glDepthFunc(), 'fun' -> function p. 172 line 7, 'examplese' -> example p. 174 (and many others) there are code snippets with a file name (e.g., occquery.c in Example 4.6), and other examples without file names (e.g., Example 4.7). For consistency, all should have a filename (with an explanation somewhere on where to find those files), or none should have a filename. p. 175 Description of glEndQuery(), target can be also GL_ANY_SAMPLES_PASSED_CONVERVATIVE p. 175 Example 4.7 should show the declaration and initialization of queryReady, and count- should be count--: p. 176 line 2, in the call glDrawArrays, delete the '}' after GL_TRIANGLE_FAN p.179 just before the Antialising Lines section: ...and polygons if the multisample results are quite *not* what you want... p.181 l. 5, Using framebuffer objects, 'you' -> we can create our own p. 183 second box, DRAW_FRAMEBUFFER -> GL_DRAW_FRAMEBUFFER, READ_FRAMEBUFFER -> GL_READ_FRAMEBUFFER and FRAMEBUFFER -> GL_FRAMEBUFFER p. 186 GL_DEPTH_COMPONENT32 is duplicated. One should be GL_DEPTH_COMPONENT24 p. 187 The third bullet point has 'absorbed' the next paragraph, starting in Each... p. 206 line -2: insert a space between viewport and mapping p.217 line 10: the coordinates of the examples are reversed, they should be (2,1) and (4, 2) p.219 line 4 (x, y) should be (x, y, z) p.220, 221, 223, 225 All figures show a left-handed coordinate system. OpenGL is right-handed by default. The Z axis should point towards the reader. p.227 In the box for vmath::rotate, remove the last sentence (that begins with "It then multiplies...") p. 362 Second line in the Section "Fragment Shaders for Different..." speculative -> specular p. 363 Example 7.1 in vec4 VertexPosition; // pre-transformed position. How is VertexPosition pre-transformed? Later, it is multiplied by the MVP matrix. p. 365 Before Section "Directional Light" whereever -> wherever p. 376 Example 7.7 second line of the comment for isLocal: false for a **directional** light p. 376 Example 7.7, comment for position: location of light, if **isLocal** is true p. 388 Figure 7.4. What is wrong with the C? p.487 first line: tessellation coordinates**s** p.489 line -7: Capitalize "tessellation" at the beginning of the sentence p.493 4 th line of the paragraph in the Isoline Tessellation subdivsion -> subdivision Caption of Example 9.4 Tesslation -> Tesselation p.494 Caption of Example 9.5 Tesslation -> Tesselation p. 495 In the text, the barycentric center of the triangle is (1/3, 1/3, 1/3), not (1/2, 1/2, 1/2) Also, if t is an odd value, there are (t-1)/2 concentric triangles, not (t/2)-1 p. 496. It would be nice to give the tessellation levels of the examples: 5, 5, 5 and 5 for the left example, and 4, 4, 4 and 4 for the right example p. 508 Before the example 9.13: requite -> require p. 514 Before the example 10.3: gl_in, which is **an** array containing p. 515 At the end of the second paragraph: The rest of the code in the shader **does not** need **any** change. p. 515 Last paragraph: Lines and triangles are generated both by independent **primitives** (**GL_LINES** and **GL_TRIANGLES** primitive types) p. 515 Last paragraph: Even if the drawing command specified **is** GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_LINE_STRIP, or GL_LINE_LOOP, the geometry shader still receives individual primitives as appropriate. p.519 Second paragraph: then the geometry output primitive type can be set to **line_strip** p. 522 Next-to-last paragraph: GL_TRIANGLES_ADJACECNCY -> GL_TRIANGLES_ADJACENCY p. 523 Sentence 4 from the bottom: The only exception to this general rule **is** for outputs that are marked with the flat keyword. p. 530 Sentence 5 from the bottom: **Black** essentially means no hair, and white represents hairs whose length is equal to the full depth of the fur volume. p. 535 First line: EmitStreamVerex -> EmitStreamVertex, and again in the 3rd line p. 683 gl_VertexID built-in variable is not described.