1、OpenGL Programming Guide Errata - Fifth EditionIf youve found something you believe is in error, please send us a note using this link.You can find erratas for previous versions here. page 87 - The third parameter, stride, in the glColorPointer() and glVertexPointer() calls is incorrectly specified
2、as 3*sizeof(GLfloat). The correct specification is 6*sizeof(GLfloat). (reported by Richard Chaney) page 377 - The paragraph beginning “The width and height parameters give the dimensions of the texture image; .“ lacks a discussion of non-power-of-two textures. The paragraph should read (with text ad
3、ditions presented in red):The width and height parameters give the dimesions of the texture image; border indicates the width of the border, which is either 0 (no border) or 1. Both width and height must have the form 2m + 2b, where m is a non-negative integer (which can have a different value for w
4、idth than for height) and b is the value of border. The maximum size of a texture map depends on the implementation of OpenGL, but it must be at least 64 64 (or 66 66 with borders). For OpenGL 2.0 implementations, the power-of-two dimension requirement has been eliminated. The same clarification sho
5、uld also be added to the other glCopyTexImage2D() (page 379), glTexImage1D() (page 385), glCopyTexImage1D() (page 386), glTexImage3D() (page 388) function descriptions, as well as for the glCompressedTexImage1D(), glCompressedTexImage2D(), and the glCompressedTexImage3D() function descriptions (page
6、 393). (reported by Paul Martz) page 627 - In the first paragraph of the “Vertex Processing“ section, the second sentence should read: The shader area indicates the functions of the vertex processing pipeline that are replaced by the vertex shader. (reported by Kouichi Matsuda) page 637 - In the sha
7、ded box for glDeleteShader(), the description should read: Deletes shader. If shader is currently linked to one or more active shader programs, the object is tagged for deletion, and only deleted once the shader object is no longer used by any shader programs. pages 636-637 - Example 15-3 uses the A
8、RB_shader_object extension, as compared to OpenGL 2.0 routines. Additionally, the coding style using for the declaration of shaderSrc in the original example could lead to confusion, and has been written more cleanly in the following code. (reported by Dmitriy Vasilev) In ANSI C, concatenated ASCII
9、strings, not separated by commas, will be combined into a single string, aligned contigiously in memory. The original example used that technique, but was probably not as clear as the updated declaration below, which uses commas to create an array of strings. The side effect of the comma-delimited a
10、rray is that you need to keep an accurate count of its size to pass into glShaderSource(). To that end, we use a macro , NumberOfLines() to count the number of elements in the array.The correct implementation is (with changes highlighted in red):GLuint shader, program;GLint compiled, linked;#define
11、NumberOfLines(x) (sizeof(x)/sizeof(x0)const GLchar* shaderSrc = “void main()”,“,“ gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;”,“”;shader = glCreateShader(GL_VERTEX_SHADER);glShaderSource(shader, NumberOfLines(shaderSrc), shaderSrc, NULL);glCompileShader(shader);glGetShaderiv(shader, GL_C
12、OMPILE_STATUS, if (!compiled) GLint length;GLchar log;glGetShaderiv(shader, GL_INFO_LOG_LENGTH, log = (GLchar*) malloc(length);glGetShaderInfoLog(shader, length, fprintf( stderr, “compile log = %sn“, log );program = glCreateProgram();glAttachShader(program, shader);glLinkProgram(program);glGetProgra
13、miv(program, GL_LINK_STATUS, if (linked) glUseProgram( vertPgm ); else GLint length;GLchar log;glGetShaderiv(shader, GL_INFO_LOG_LENGTH, log = (GLchar*) malloc(length);glGetShaderInfoLog(shader, length, fprintf( stderr, “link log = %sn“, log ); page 642 - The GLSL types for the code snippet describi
14、ng the initialization of a matrix from column vectors is incorrect. The example should be: vec3 column1 = vec3( 4.0, 0.0, 0.0 ); vec3 column2 = vec3( 0.0, 4.0, 0.0 );.and for the declaration of the initialized matrixmat3 m = mat3( column1, column2, column3 );(reported by William Hesse) page 646 - In
15、 the shaded box for glGetUniformLocation(), the last sentence of the second paragraph should be replaced with: For arrays of uniform variables, the index of the first element of the array may be queried either by specifying the only the array name (for example, “arrayName“), or by specifying the ind
16、ex to the first element of the array (as in “arrayName0“). (reported by Kouichi Matsuda) page 660 - The second sentence in the first paragraph should be: Each client-side vertex array needs to be enabled. (reported by Kouichi Matsuda) page 661 - The second sentence of the last paragarph should begin with: By default, . (reported by Kouichi Matsuda) page 814 - The index contains the entry “buffer object, 817“. This entry should be removed from the index. (reported by Paul Martz, and Zeb Mason)