Skip to content

Lower level

compileShader() ​

ts
function compileShader(
   gl, 
   source, 
   type
): WebGLShader;

Defined in: compileShader.js:24

Compiles a shader. On failure throws an error naming the shader type, with the compiler log and the source lines it points at.

Parameters ​

ParameterTypeDescription
glWebGL2RenderingContextThe WebGL2 context.
sourcestringGLSL ES 3.00 source.
typenumbergl.VERTEX_SHADER or gl.FRAGMENT_SHADER.

Returns ​

WebGLShader