Program

Program

new Program(gl, vertSrc, fragSrc, params)

constructor compile shaders and link them to gl context
Source:
Parameters:
Name Type Description
gl WebGLRenderingContext
vertSrc string
fragSrc string
params Object
Name Type Description
isDebug booean

Members

attrib :object

Source:
Type:
  • object

uniform :object

Source:
Type:
  • object

Methods

bind()

use program, as same function as use()
Source:

dispose()

dispose program
Source:

getAttrib(name)

get the value of the attribute of program(it will be remove)
Source:
Parameters:
Name Type Description
name string name of attributes

getUniforms(name)

get the value of uniform of program(it will be removed)
Source:
Parameters:
Name Type Description
name string name of uniforms

initProgram(vertSrc, fragSrc, params)

crate the program and compile shader
Source:
Parameters:
Name Type Description
vertSrc string vertex hader
fragSrc string fragment shader src
params Object optinal paramters

setUniformTexture(texture, uniformName)

set texture as uniform
Source:
Parameters:
Name Type Description
texture Texture
uniformName String

use()

use program, as same function as bind()
Source: