Graphics Reference
In-Depth Information
void glGetShaderInfoLog (GLuint shader , GLsizei maxLength ,
GLsizei *length , GLchar *infoLog )
shader handle to the shader object for which to get the info log
maxLength the size of the buffer in which to store the info log
length
the length of the info log written (minus the null
terminator); if the length does not need to be known, this
parameter can be NULL
pointer to the character buffer in which to store the info log
infoLog
The info log does not have any mandated format or required information.
Nevertheless, most OpenGL ES 3.0 implementations will return error
messages that contain the line number of the source code on which the
compiler was working when it detected the error. Some implementations
will also provide warnings or additional information in the log. For
example, the following error message is produced by the compiler when
the shader source code contains an undeclared variable:
ERROR: 0:10: 'i_position' : undeclared identifier
ERROR: 0:10: 'assign' : cannot convert from '4X4 matrix of float'
to 'vertex out/varying 4-component vector of float'
ERROR: 2 compilation errors. No code generated.
At this point, we have shown you all of the functions you need to create
a shader, compile it, find out the compile status, and query the info log.
For review, Example 4-1 shows the code from Chapter 2, “Hello Triangle:
An OpenGL ES 3.0 Example,” to load a shader that uses the functions just
described.
Example 4-1
Loading a Shader
GLuint LoadShader ( GLenum type, const char *shaderSrc )
{
GLuint shader;
GLint compiled;
// Create the shader object
shader = glCreateShader ( type );
if ( shader == 0 )
{
return 0;
}
(continues)
 
 
Search WWH ::




Custom Search