Gambas Documentation - /comp/gb.opengl.glsl/gl/compileshader

# Gl.CompileShader (gb.opengl.glsl)

Static Sub CompileShader ( Shader As Integer )

Compiles a shader object.

### Parameters

shader

  Specifies the shader object to be compiled.

### Description

Gl.CompileShader compiles the source code strings that have been stored in the shader object specified by shader.

The compilation status will be stored as part of the shader object's state. This value will be set to Gl.TRUE if the shader was compiled without errors and is ready for use, and Gl.FALSE otherwise. It can be queried by calling Gl.GetShader with arguments shader and Gl.COMPILE_STATUS.

Compilation of a shader can fail for a number of reasons as specified by the OpenGL Shading Language Specification. Whether or not the compilation was successful, information about the compilation can be obtained from the shader object's information log by calling Gl.GetShaderInfoLog.

### Errors

Gl.INVALID_VALUE is generated if shader is not a value generated by OpenGL.

Gl.INVALID_OPERATION is generated if shader is not a shader object.

### Associated Gets

Gl.GetShaderInfoLog with argument shader

Gl.GetShader with arguments shader and Gl.COMPILE_STATUS

Gl.IsShader

### See also

- Gl.CreateShader,

- Gl.LinkProgram,

- Gl.ShaderSource

See original documentation on OpenGL website