Class GLShader

a base GL Shader object

Constructors

Properties

attributes: number[]

the location attributes of the shader

fragment: string

the fragment shader source code

the active gl rendering context

program: WebGLProgram

a reference to the shader program (once compiled)

uniforms: object

the uniforms of the shader

vertex: string

the vertex shader source code

Methods

  • returns the location of an attribute variable in this shader program

    Parameters

    • name: string

      the name of the attribute variable whose location to get.

    Returns number

    number indicating the location of the variable name if found. Returns -1 otherwise

  • Set the uniform to the given value

    Parameters

    • name: string

      the uniform name

    • value: object | Float32Array

      the value to assign to that uniform

    Returns void

    myShader.setUniform("uProjectionMatrix", this.projectionMatrix);
    
  • activate the given vertex attribute for this shader

    Parameters

    • gl: WebGLRenderingContext

      the current WebGL rendering context

    • attributes: object[]

      an array of vertex attributes

    • vertexByteSize: number

      the size of a single vertex in bytes

    Returns void