shaderProgram

vgl. shaderProgram

new shaderProgram() → {vgl.shaderProgram}

Description:
  • Create a new instance of class shaderProgram.

Source:
Returns:
Type
vgl.shaderProgram

Methods

addShader(shader) → {boolean}

Description:
  • Add a new shader to the program.

Source:
Parameters:
Name Type Description
shader string
Returns:
Type
boolean

addUniform(uniform) → {boolean}

Description:
  • Add a new uniform to the program.

Source:
Parameters:
Name Type Description
uniform vgl.uniform
Returns:
Type
boolean

addVertexAttribute(attr, key)

Description:
  • Add a new vertex attribute to the program.

Source:
Parameters:
Name Type Description
attr vgl.vertexAttribute
key string

attributeLocation(name) → {number}

Description:
  • Get attribute location.

    This method does not perform any query into the program but relies on the fact that it depends on a call to queryUniformLocation earlier.

Source:
Parameters:
Name Type Description
name string
Returns:
Type
number

bind(renderState)

Description:
  • Bind the program with its shaders.

Source:
Parameters:
Name Type Description
renderState vgl.renderState

bindAttributes(renderState)

Description:
  • Bind vertex attributes.

Source:
Parameters:
Name Type Description
renderState vgl.renderState

bindUniforms(renderState)

Description:
  • Bind uniforms.

Source:
Parameters:
Name Type Description
renderState vgl.renderState

bindVertexData(renderState, key)

Description:
  • Bind vertex data.

Source:
Parameters:
Name Type Description
renderState vgl.renderState
key string
Description:
  • Compile and link a shader.

Source:
Parameters:
Name Type Description
renderState vgl.renderState

deleteProgram(renderState)

Description:
  • Delete the shader program.

Source:
Parameters:
Name Type Description
renderState vgl.renderState

deleteVertexAndFragment(renderState)

Description:
  • Delete vertex and fragment shaders.

Source:
Parameters:
Name Type Description
renderState vgl.renderState
Description:
  • Link shader program.

Source:
Parameters:
Name Type Description
renderState vgl.renderState
Returns:
Type
boolean

queryAttributeLocation(renderState, name) → {number}

Description:
  • Query attribute location in the program.

Source:
Parameters:
Name Type Description
renderState vgl.renderState
name string
Returns:
Type
number

queryUniformLocation(renderState, name) → {number}

Description:
  • Query uniform location in the program.

Source:
Parameters:
Name Type Description
renderState vgl.renderState
name string
Returns:
Type
number

undoBind(renderState)

Description:
  • Undo binding of the shader program.

Source:
Parameters:
Name Type Description
renderState vgl.renderState

undoBindVertexData(renderState, key)

Description:
  • Undo bind vertex data.

Source:
Parameters:
Name Type Description
renderState vgl.renderState
key string

uniform(name) → {vgl.uniform}

Description:
  • Get uniform object using name as the key.

Source:
Parameters:
Name Type Description
name string
Returns:
Type
vgl.uniform

uniformLocation(name) → {number}

Description:
  • Get uniform location.

    This method does not perform any query into the program but relies on the fact that it depends on a call to queryUniformLocation earlier.

Source:
Parameters:
Name Type Description
name string
Returns:
Type
number

updateUniforms(renderState)

Description:
  • Update all uniforms.

    This method should not be used directly unless required.

Source:
Parameters:
Name Type Description
renderState vgl.renderState

use(renderState)

Description:
  • Use the shader program.

Source:
Parameters:
Name Type Description
renderState vgl.renderState