WebGLRenderingContext.createShader()

The WebGLRenderingContext method createShader() of the WebGL API creates a WebGLShader that can then be configured further using WebGLRenderingContext.shaderSource() and WebGLRenderingContext.compileShader().

Syntax

WebGLShader gl.createShader(type);

Parameters

type

Either gl.VERTEX_SHADER or gl.FRAGMENT_SHADER

Examples

See WebGLShader for usage and examples.

Specifications

Specification
WebGL Specification (WebGL)
# 5.14.9

Browser compatibility

BCD tables only load in the browser

See also