前言

​glGetShaderInfoLog函数官方文档地址:​

Name

glGetShaderInfoLog — Returns the information log for a shader object

C Specification

​void glGetShaderInfoLog(​

GLuint shader,

GLsizei maxLength,

GLsizei *length,

GLchar *infoLog​​)​​;

Parameters

shader

Specifies the shader object whose information log is to be queried.

maxLength

Specifies the size of the character buffer for storing the returned information log.

length

Returns the length of the string returned in ​infoLog

infoLog

Specifies an array of characters that is used to return the information log.

Description

​glGetShaderInfoLog​​ returns the information log for the specified shader object. The information log for a shader object is modified when the shader is compiled. The string that is returned will be null terminated.

​glGetShaderInfoLog​​​ returns in ​infoLog​​ as much of the information log as it can, up to a maximum of ​maxLength​​ characters. The number of characters actually returned, excluding the null termination character, is specified by ​length​​. If the length of the returned string is not required, a value of ​​NULL​​​ can be passed in the ​length​​ argument. The size of the buffer required to store the returned information log can be obtained by calling ​​glGetShaderiv​​​ with the value ​​GL_INFO_LOG_LENGTH​​.

The information log for a shader object is a string that may contain diagnostic messages, warning messages, and other information about the last compile operation. When a shader object is created, its information log will be a string of length 0.

Notes

The information log for a shader object is the OpenGL implementer's primary mechanism for conveying information about the compilation process. Therefore, the information log can be helpful to application developers during the development process, even when compilation is successful. Application developers should not expect different OpenGL implementations to produce identical information logs.

Errors

​GL_INVALID_VALUE​​​ is generated if ​shader

​GL_INVALID_OPERATION​​​ is generated if ​shader

​GL_INVALID_VALUE​​​ is generated if ​maxLength

Associated Gets

​glGetShaderiv​​​ with argument ​​GL_INFO_LOG_LENGTH​

​glIsShader​

API Version Support

OpenGL ES API Version

Function Name

2.0

3.0

3.1

3.2

glGetShaderInfoLog





See Also

​glCompileShader​​​, ​​glGetProgramInfoLog​​​, ​​glLinkProgram​​​, ​​glValidateProgram​

Copyright

Copyright © 2003-2005 3Dlabs Inc. Ltd. Copyright © 2010-2015 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. ​​http://opencontent.org/openpub/​​.

翻译:

名称

glGetShaderInfoLog - 返回着色器对象的信息日志

C规范

void glGetShaderInfoLog(GLuint shader,GLsizei maxLength,GLsizei *length,GLchar *infoLog);

参数

shader

    指定要查询其信息日志的着色器对象。

maxLength

    指定用于存储返回的信息日志的字符缓冲区的大小。

length

    返回infoLog中返回的字符串的长度(不包括空终止符)。

infoLog

    指定用于返回信息日志的字符数组。

描述

    glGetShaderInfoLog返回指定着色器对象的信息日志。 编译着色器时,将修改着色器对象的信息日志。 返回的字符串将以空结尾。

    glGetShaderInfoLog尽可能多地在infoLog中返回信息日志,最多可返回maxLength个字符。实际返回的字符数(不包括空终止字符)由length指定。 如果不需要返回字符串的长度,则可以在length参数中传递NULL值。 可以通过调用值为GL_INFO_LOG_LENGTH的​​glGetShaderiv​​来获取存储返回的信息日志所需的缓冲区大小。

    着色器对象的信息日志是一个字符串,其中可能包含诊断信息,警告信息以及有关上次编译操作的其他信息。 创建着色器对象时,其信息日志将为长度为0的字符串。

注意

    着色器对象的信息日志是OpenGL实现者用于传达有关编译过程的信息的主要机制。 因此,即使编译成功,信息日志也可以在开发过程中对应用程序开发人员有所帮助。 应用程序开发人员不应期望不同的OpenGL实现生成相同的信息日志。

错误

GL_INVALID_VALUEshader不是OpenGL生成的值。

GL_INVALID_OPERATIONshader不是着色器对象。

GL_INVALID_VALUEmaxLength小于0

相关Gets

​glGetShaderiv​​ 参数GL_INFO_LOG_LENGTH获取信息日志的长度

​glIsShader​

另见

​glCompileShader​​​,​​glGetProgramInfoLog​​​,​​glLinkProgram​​​,​​glValidateProgram​

版权

​https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glGetShaderInfoLog.xml​

Copyright © 1991-2006 Silicon Graphics, Inc.本文档的许可是根据SGI Free Software B License.详见​​http://oss.sgi.com/projects/FreeB/​​.

​程序工程源码地址:​

程序运行结果

openGL ES3.0 glGetShaderInfoLog函数详解_openGLES3.0