opengl红宝书【FIFTH】--error.doc_第1页
opengl红宝书【FIFTH】--error.doc_第2页
opengl红宝书【FIFTH】--error.doc_第3页
opengl红宝书【FIFTH】--error.doc_第4页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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 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 additions 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 width 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 6464 (or 6666 with borders). For OpenGL 2.0 implementations, the power-of-two dimension requirement has been eliminated. The same clarification should 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 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 shaded 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 ARB_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 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 array 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 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_COMPILE_STATUS, &compiled );if (!compiled) GLint length; GLchar log; glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &length ); log = (GLchar*) malloc(length); glGetShaderInfoLog(shader, length, &length, log); fprintf( stderr, compile log = %sn, log );program = glCreateProgram();glAttachShader(program, shader);glLinkProgram(program);glGetProgramiv(program, GL_LINK_STATUS, &linked );if (linked) glUseProgram( vertPgm ); else GLint length; GLchar log; glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &length ); log = (GLchar*) malloc(length); glGetShaderInfoLog(shader, length, &length, log); fprintf( stderr, link log = %sn, log ); page 642 - The GLSL types for the code snippet describing 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 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 index 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 66

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论