Class: ShaderController

og/webgl/ShaderController~ShaderController

new ShaderController(handler, shaderProgram)

This is shader program controller that used by hadler object to access the shader program capabilities, like switching program during the rendering. Get access to the program from ...handler.shaderPrograms. etc.
Name Type Description
handler og.webgl.Handler Handler.
shaderProgram og.webgl.ShaderProgram Shader program.

Methods

activate(){ShaderController}

Activates current shader program.
Returns:
Type Description
ShaderController -
Deactivate shader program. This is not necessary while activae function used.

drawArray(mode, numItems){og.webgl.ShaderController}

Calls Gl drawArray function.
Name Type Description
mode number Gl draw mode.
numItems number draw items count.
Returns:
Type Description
og.webgl.ShaderController Returns current shader controller instance.

drawIndexBuffer(mode, buffer){og.webgl.ShaderController}

Draw index buffer with this program.
Name Type Description
mode number Gl draw mode
buffer WEBGLBuffer Buffer to draw.
Returns:
Type Description
og.webgl.ShaderController Returns current shader controller instance.

getProgram(){og.webgl.ShaderProgram}

Returns controller's shader program.
Returns:
Type Description
og.webgl.ShaderProgram -
Lazy create program call.

isActive(){boolean}

Returns program activity.
Returns:
Type Description
boolean -
Remove program from handler

set(params){og.webgl.ShaderController}

Sets program uniforms and attributes values and return controller instance.
Name Type Description
params Object Object with variable name and value like { value: 12, someArray:[1,2,3], uSampler: texture,... }
Returns:
Type Description
og.webgl.ShaderController -