Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Shader Abstract

Hierarchy

Index

Constructors

  • new Shader(name: string): Shader

Properties

_attributes: Map<string, number> = ...
_name: string
_program: null | WebGLProgram = null
_uniforms: Map<string, WebGLUniformLocation> = ...

Accessors

  • get name(): string

Methods

  • createProgram(vertexShader: WebGLShader, fragmentShader: WebGLShader): void
  • Creates a WebGL program using the shaders given.

    Parameters

    • vertexShader: WebGLShader
    • fragmentShader: WebGLShader

    Returns void

    void

  • destroy(): void
  • detectAttributes(): void
  • detectUniforms(): void
  • getAttribLocation(name: string): number
  • getUniformLocation(name: string): WebGLUniformLocation
  • Gets the uniform location of the shader.

    Parameters

    • name: string

    Returns WebGLUniformLocation

    WebGLUniformLocation

  • load(vertexSource: string, fragmentSource: string): void
  • Loads the vertex and fragment sources given.

    Parameters

    • vertexSource: string
    • fragmentSource: string

    Returns void

    void

  • loadShader(source: string, type: number): WebGLShader
  • Loads the shader from source and by the type.

    Parameters

    • source: string
    • type: number

      WebGL constant (VERTEX_SHADER or FRAGMENT_SHADER)

    Returns WebGLShader

    WebGLShader

  • use(): void

Generated using TypeDoc