Class: PrimitiveShader

PrimitiveShader


new PrimitiveShader(shaderManager)

This shader is used to draw simple primitive shapes for Graphics.

Parameters:
Name Type Description
shaderManager ShaderManager

The webgl shader manager this shader works for.

Source:

Extends

Members


fragmentSrc :string

The fragment shader as an array of strings

Type:
  • string
Inherited From:
Source:

<readonly> gl :WebGLRenderingContext

The current WebGL drawing context

Type:
  • WebGLRenderingContext
Inherited From:
Source:

<readonly> program :WebGLProgram

The WebGL program.

Type:
  • WebGLProgram
Inherited From:
Source:

<readonly> uid :number

A unique id

Type:
  • number
Inherited From:
Source:

vertexSrc :string

The vertex shader as an array of strings

Type:
  • string
Inherited From:
Source:

Methods


cacheAttributeLocations(keys)

Caches the locations of the attribute for reuse.

Parameters:
Name Type Description
keys string

the attributes to cache

Inherited From:
Source:

cacheUniformLocations(keys)

Caches the locations of the uniform for reuse.

Parameters:
Name Type Description
keys string

the uniforms to cache

Inherited From:
Source:

compile()

Attaches the shaders and creates the program.

Inherited From:
Source:
Returns:
Type
WebGLProgram

destroy()

Destroys the shader.

Inherited From:
Source:

init()

Creates the shader and uses it

Inherited From:
Source:

initSampler2D()

Initialises a Sampler2D uniform (which may only be available later on after initUniforms once the texture has loaded)

Inherited From:
Source:

syncUniform(uniform)

Adds a new uniform

Parameters:
Name Type Description
uniform object

the new uniform to attach

Inherited From:
Source:

syncUniforms()

Updates the shader uniform values.

Inherited From:
Source: