WebGLProgram extension type
The WebGLProgram
is part of the
WebGL API and
is a combination of two compiled WebGLShaders consisting of a vertex
shader and a fragment shader (both written in GLSL).
To create a WebGLProgram
, call the GL context's
WebGLRenderingContext.createProgram function. After attaching the shader
programs using WebGLRenderingContext.attachShader, you link them into a
usable program. This is shown in the code below.
const program = gl.createProgram();
// Attach pre-existing shaders
gl.attachShader(program, vertexShader);
gl.attachShader(program, fragmentShader);
gl.linkProgram(program);
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
const info = gl.getProgramInfoLog(program);
throw `Could not compile WebGL program. \n\n${info}`;
}
See WebGLShader for information on creating the vertexShader
and
fragmentShader
in the above example.
API documentation sourced from MDN Web Docs.
- on
- Implemented types
- Available extensions
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited