Expand/Shrink

glGetShaderParameter

Definition: include pGUI.e
include opengl.e

integer res = glGetShaderParameter(integer shader, pname, dflt=0)
Description: return the value of a parameter from a shader object

shader: Specifies the shader object to be queried.
pname: Specifies the object parameter. Accepted symbolic names are listed below.
dflt: (optional) the value to return when an error occurs.
pwa/p2js: Supported.
Notes: The opengl.e wrapper returns a result whereas the C api requires the address of a result variable containing a pre-poked default to be provided as the third parameter.

On desktop/Phix, this wraps the C glGetShaderiv function (but with a different third argument).

The following parameters are defined:

GL_SHADER_TYPE returns GL_VERTEX_SHADER or GL_FRAGMENT_SHADER.

GL_DELETE_STATUS returns true if shader is currently flagged for deletion.

GL_COMPILE_STATUS returns false if the last compile operation on shader was unsuccessful.

Note that GL_INFO_LOG_LENGTH and GL_SHADER_SOURCE_LENGTH are not supported by WebGL and hence pwa/p2js, instead opengl.e uses them internally as part of the automatic buffer management. Technically they still work on the desktop and are permitted by the transpiler (since they are valid inside a platform()!=JS test), but generate an explicit runtime crash in pGUI.js.

Technically shader compiler support is optional, however opengl.e and pwa/p2js simply assume it is always available.

If an error is generated the specified default is returned, however explicitly checking glGetError()!=GL_NO_ERROR should normally be used to verify that an error did actually occur, unless that is the said default is unequivocably invalid.
Errors: GL_INVALID_ENUM is generated if pname is not an accepted value.
GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.
GL_INVALID_OPERATION is generated if pname is GL_COMPILE_STATUS, GL_INFO_LOG_LENGTH, or GL_SHADER_SOURCE_LENGTH but a shader compiler is not supported.
GL_INVALID_OPERATION is generated if shader does not refer to a shader object.
Associated Gets: glGet with argument GL_SHADER_COMPILER
glGetShaderInfoLog with argument shader
glGetShaderSource with argument shader
glIsShader
See Also: glCompileShader, glCreateShader, glDeleteShader, glGetProgramParameter, glShaderSource, z
DEV See Also //glCompileShader, //glCreateShader, //glDeleteShader, //glGetProgramParameter, //glShaderSource, glShaderBinary