Class: Program

Program

new Program(params)

Name Type Description
params Object

初始化参数,所有params都会复制到实例上

Name Type Description
state WebGLState

WebGL state

Members Show Inherited

Name Type Default Description
className String Program
isProgram Boolean true
fragShader String ''

片段代码

vertexShader String ''

顶点代码

attributes Object null

attribute 集合

uniforms Object null

uniform 集合

program WebGLProgram null

program

gl WebGL

gl

state WebGLState null

webglState

id String

id

static,readonlyProgram.cache

缓存

Methods Show Inherited

staticProgram.reset()

重置缓存

staticProgram.getProgram(shader, state, ignoreError){Program}

获取程序

Name Type Default Description
shader Shader
state WebGLState
ignoreError Boolean false optional
Returns:
Type Description
Program

staticProgram.getBlankProgram(state){Program}

获取空白程序

Name Type Description
state WebGLState
Returns:
Type Description
Program

createProgram(){WebGLProgram}

生成 program

Returns:
Type Description
WebGLProgram

使用 program

createShader(shaderType, code){WebGLShader}

生成 shader

Name Type Description
shaderType Number
code String
Returns:
Type Description
WebGLShader

initAttributes()

初始化 attribute 信息

initUniforms()

初始化 uniform 信息

destroyIfNoRef(renderer){Program}

没有被引用时销毁资源

Name Type Description
renderer WebGLRenderer
Returns:
Type Description
Program this

销毁资源

Returns:
Type Description
Program this