-
new Program(params)
-
Name Type Description params
Object optional 初始化参数,所有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 集合 |
uniformBlocks
|
Object | null |
uniformBlock 集合 |
program
|
WebGLProgram | null |
program |
gl
|
WebGLRenderingContext |
gl |
|
state
|
WebGLState | null |
webglState |
alwaysUse
|
Boolean | true |
是否始终使用 |
isWebGL2
|
Boolean | false |
是否是 WebGL2 |
id
|
String |
id |
-
static,readonlyProgram.cacheCache
-
缓存
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 -
useProgram()
-
使用 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