Properties:
| Name | Type | Description |
|---|---|---|
context2d |
object | [readonly] The 2D canvas context. |
originalHeight |
number | (default: |
originalWidth |
number | (default: |
fragmentShader |
string | (default: |
errorMessage |
string | (default: |
Extends
Methods
-
Renders using the configured fragment shader and returns the rendering time in nanoseconds precison, if measuring was requested and the platform supports it. Not all browsers may support the timer extension for measuring on all platforms, though.
Name Type Description measurebool Whether to measure the rendering time.
Returns:
Type Description number The rendering time in nanoseconds, if measuring was requested. This value is -1if not supported by platform, or measuring was not requested. -
Sets a 2D sampler (texture) value to pass to the fragment shader.
The
parametersdictionary may contain these string entries:wrap:[repeat|clamp|mirror, repeat|clamp|mirror]filter:[linear|nearest, linear|nearest]mipmap:[true|false](Generate mipmap textures)data:[true|false](Use this for storing data textures)
Name Type Description namestring The name of the uniform. It must be defined by that name in the shader.
widthnumber The width of the texture. This value is ignored if
valueis an image type.heightnumber The height of the texture. This value is ignored if
valueis an image type.valueany The texture value to set. Either an image type, or a
Float32Arrayor aInt32Array.parametersobject A dictionary of parameters.
-
Sets a uniform value to pass to the fragment shader.
When passing vectors and matrices, they must be of the form created by Shellfish's matrix tools.
Name Type Description typestring The type of uniform. Supported types are:
float|int|mat3|mat4|vec2|vec3|vec4namestring The name of the uniform. It must be defined by that name in the shader.
valueany The value to set.
- See:
-
- matrix
-
Updates an area of a sampler (texture). This allows updating a part of a texture without having to re-upload the full texture to the GPU.
Name Type Description namestring The name of the uniform. It must be defined by that name in the shader.
widthnumber The width of the new area.
heightnumber The height of the new area.
valueany The texture value to set. Either an image type, or a
Float32Arrayor aInt32Array.