Methods
-
getShaderProgram() → ShaderProgram
-
根据 GLSL 顶点和片段着色器源和属性位置,从缓存中返回着色器程序,或创建并缓存一个新的着色器程序。
Name Type Description options.vertexShaderSource
String | ShaderSource 顶点着色器的 GLSL 源。 options.fragmentShaderSource
String | ShaderSource 片段着色器的 GLSL 源。 options.attributeLocations
Object 顶点着色器的属性输入索引。 Returns:
缓存或新创建的着色器程序。 -
replaceShaderProgram() → ShaderProgram
-
从缓存中返回着色器程序,或根据 GLSL 顶点和片段着色器源和属性位置创建并缓存一个新的着色器程序。 它与
ShaderCache#getShaderProgram
的区别在于,它是用来替换着色器程序的现有引用,而着色器程序是作为第一个参数传递的。Name Type Description options.shaderProgram
ShaderProgram optional 被重新分配的着色器程序。 options.vertexShaderSource
String | ShaderSource 顶点着色器的 GLSL 源。 options.fragmentShaderSource
String | ShaderSource 片段着色器的 GLSL 源。 options.attributeLocations
Object 顶点着色器的属性输入索引。 Returns:
缓存或新创建的着色器程序。Example:
this._shaderProgram = context.shaderCache.replaceShaderProgram({ shaderProgram : this._shaderProgram, vertexShaderSource : vs, fragmentShaderSource : fs, attributeLocations : attributeLocations });
See: