files/en-us/web/api/webglrenderingcontext/createshader/index.md
{{APIRef("WebGL")}}{{AvailableInWorkers}}
The {{domxref("WebGLRenderingContext")}}
method createShader() of the WebGL API creates a
{{domxref("WebGLShader")}} that can then be configured further using
{{domxref("WebGLRenderingContext.shaderSource()")}} and
{{domxref("WebGLRenderingContext.compileShader()")}}.
createShader(type)
type
gl.VERTEX_SHADER or gl.FRAGMENT_SHADER. The {{domxref("WebGLRenderingContext")}} will set the gl.INVALID_ENUM error flag if an unacceptable value has been specified.A new {{domxref("WebGLShader")}} instance, or null if an error occurs creating the shader (for example, because type was an invalid value).
See {{domxref("WebGLShader")}} for usage and examples.
{{Specifications}}
{{Compat}}