WebGLRenderingContext.shaderSource()
The WebGLRenderingContext.shaderSource() method of the WebGL API sets the source code of a
WebGLShader.
Syntax
void gl.shaderSource(shader, source);
Parameters
- shader
-
A
WebGLShaderobject in which to set the source code. - source
-
A
DOMStringcontaining the GLSL source code to set.
Return value
None.
Examples
var shader = gl.createShader(gl.VERTEX_SHADER);
gl.shaderSource(shader, originalSource);
var source = gl.getShaderSource(shader);
Specifications
| Specification |
|---|
| WebGL Specification # 5.14.9 |
Browser compatibility
BCD tables only load in the browser