Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GLProgram

Helper class to manage GL shader programs.

Hierarchy

  • GLProgram

Index

Constructors

constructor

  • new GLProgram(gl: WebGLRenderingContext, vertexSrc: string, fragmentSrc: string, attributeLocations?: IDictionary<number>): GLProgram
  • Parameters

    • gl: WebGLRenderingContext

      The rendering context.

    • vertexSrc: string

      The vertex shader source as an array of strings.

    • fragmentSrc: string

      The fragment shader source as an array of strings.

    • Optional attributeLocations: IDictionary<number>

      A key value pair showing which location each attribute should sit eg { position: 0, uvs: 1 }.

    Returns GLProgram

Properties

attributes

attributes: IDictionary<number>

The attribute locations of this program

program

program: WebGLProgram

The underlying GL program.

uniforms

uniforms: IDictionary<WebGLUniformLocation>

The uniform locations of this program

Methods

Static compileProgram

  • compileProgram(gl: WebGLRenderingContext, vertexSrc: string, fragmentSrc: string, attributeLocations?: IDictionary<number>): WebGLProgram
  • Parameters

    • gl: WebGLRenderingContext

      The rendering context.

    • vertexSrc: string

      The vertex shader source as an array of strings.

    • fragmentSrc: string

      The fragment shader source as an array of strings.

    • Optional attributeLocations: IDictionary<number>

      A key value pair showing which location each attribute should sit eg { position: 0, uvs: 1 }.

    Returns WebGLProgram

Static compileShader

  • compileShader(gl: WebGLRenderingContext, type: number, source: string): WebGLShader
  • Compiles source into a program.

    Parameters

    • gl: WebGLRenderingContext

      The rendering context.

    • type: number

      The type, can be either gl.VERTEX_SHADER or gl.FRAGMENT_SHADER.

    • source: string

      The fragment shader source as an array of strings.

    Returns WebGLShader

Generated using TypeDoc