new TextureShader(shaderManager [, vertexSrc] [, fragmentSrc] [, customUniforms] [, fragmentSrc])
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
shaderManager |
ShaderManager | The webgl shader manager this shader works for. |
|
vertexSrc |
string |
<optional> |
The source of the vertex shader. |
fragmentSrc |
string |
<optional> |
The source of the fragment shader. |
customUniforms |
object |
<optional> |
Custom uniforms to use to augment the built-in ones. |
fragmentSrc |
string |
<optional> |
The source of the fragment shader. |
Extends
Members
-
<static, constant> defaultFragmentSrc
-
The default fragment shader source
-
<static, constant> defaultVertexSrc
-
The default vertex shader source
-
fragmentSrc :string
-
The fragment shader as an array of strings
Type:
- string
- Inherited From:
- Source:
-
<readonly> gl :WebGLRenderingContext
-
The current WebGL drawing context
Type:
- WebGLRenderingContext
- Inherited From:
- Source:
-
<readonly> program :WebGLProgram
-
The WebGL program.
Type:
- WebGLProgram
- Inherited From:
- Source:
-
<readonly> uid :number
-
A unique id
Type:
- number
- Inherited From:
- Source:
-
vertexSrc :string
-
The vertex shader as an array of strings
Type:
- string
- Inherited From:
- Source:
-
<inner> fragmentSrc :string
-
The fragment shader.
Type:
- string
-
<inner> vertexSrc :string
-
The vertex shader.
Type:
- string
Methods
-
cacheAttributeLocations(keys)
-
Caches the locations of the attribute for reuse.
Parameters:
Name Type Description keys
string the attributes to cache
- Inherited From:
- Source:
-
cacheUniformLocations(keys)
-
Caches the locations of the uniform for reuse.
Parameters:
Name Type Description keys
string the uniforms to cache
- Inherited From:
- Source:
-
compile()
-
Attaches the shaders and creates the program.
- Inherited From:
- Source:
Returns:
- Type
- WebGLProgram
-
destroy()
-
Destroys the shader.
- Inherited From:
- Source:
-
init()
-
Creates the shader and uses it
- Inherited From:
- Source:
-
initSampler2D()
-
Initialises a Sampler2D uniform (which may only be available later on after initUniforms once the texture has loaded)
- Inherited From:
- Source:
-
syncUniform(uniform)
-
Adds a new uniform
Parameters:
Name Type Description uniform
object the new uniform to attach
- Inherited From:
- Source:
-
syncUniforms()
-
Updates the shader uniform values.
- Inherited From:
- Source: