Class Program

A WebGL2 shader program.

Hierarchy (View Summary)

Constructors

  • Create a shader program.

    Parameters

    • context: Context

      The rendering context.

    • vertexShader: Shader

      The vertex shader.

    • fragmentShader: Shader

      The fragment shader.

    • OptionalattributeLocations: Map<string, number>

      A map of attribute names to their desired locations.

    • OptionalfeedbackVaryings: Iterable<string, any, any>

      The names of the varyings that should be tracked for transform feedback.

    • feedbackMode: MergeOrder = MergeOrder.SEPARATE_ATTRIBS

      The mode to use when capturing transform feedback varyings.

    Returns Program

    ProgramLinkError if the shaders have different contexts, if either shader is not the correct type, or if there is an issue when linking the shader program.

Properties

attributes: Map<string, Attribute>

The attributes in this shader program.

context: Context

The rendering context.

fragmentShader: Shader

The fragment shader of this shader program.

uniforms: Map<string, Uniform>

The uniforms in this shader program.

varyings: Map<string, Varying>

The transform feedback varyings in this shader program.

vertexShader: Shader

The vertex shader of this shader program.

Accessors

  • get deleteStatus(): boolean
  • The deletion status of this shader program.

    Returns boolean

  • get linkStatus(): boolean
  • The linking status of this shader program.

    Returns boolean

  • get validateStatus(): boolean
  • The validation status of this shader program.

    Returns boolean

Methods

  • Create a shader program from the given shader source code.

    Parameters

    • context: Context

      The rendering context.

    • vss: string

      The vertex shader's source code.

    • fss: string

      The fragment shader's source code.

    Returns Program

    The shader program.

    ProgramLinkError if the shaders have different contexts, if either shader is not the correct type, or if there is an issue when linking the shader program.

    UnsupportedOperationError if a shader program cannot be created.

    UnsupportedOperationError if a shader cannot be created.

    ShaderCompileError if a shader fails to compile.