Options
All
  • Public
  • Public/Protected
  • All
Menu

Thin wrapper around WebGLProgram, and WebGLShader to simplify usage.

Hierarchy

  • ShaderProgram

Index

Constructors

constructor

  • Initialize ShaderProgram object.

    Parameters

    • gl: WebGLRenderingContext

      WebGLRenderingContext to use for the shaders and program.

    • scripts: Scripts

      Sources for both vertex and fragment shaders to be used.

    • Default value name: string = "default"

      The name of the program (useful in debugging).

    Returns ShaderProgram

Accessors

program

  • get program(): WebGLProgram

Methods

getAttribLocation

  • getAttribLocation(name: string): number
  • Gets the attribute location for the provided name.

    throws

    Error if no attribute with the provided name.

    Parameters

    • name: string

      Name of the attribute to locate.

    Returns number

getUniformLocation

  • getUniformLocation(name: string): WebGLUniformLocation
  • Gets the uniform location for the provided name.

    throws

    Error if no uniform with the provided name.

    Parameters

    • name: string

      Name of the uniform to locate.

    Returns WebGLUniformLocation

Protected load

  • load(vertexSource: string, fragmentSource: string): void
  • Loads the provided sources into a compiled program.

    Parameters

    • vertexSource: string

      Source for the vertex shader.

    • fragmentSource: string

      Source for the fragment shader.

    Returns void