Class SpiderGL.WebGL.Texture2D
The SpiderGL.WebGL.Texture2D is a wrapper for 2D WebGLTexture objects
- Defined in: webgl.js
- Extends SpiderGL.WebGL.Texture
Constructor Attributes | Constructor Name and Description |
---|---|
SpiderGL.WebGL.Texture2D(gl, options)
Creates a SpiderGL.WebGL.Texture2D.
|
- Fields borrowed from class SpiderGL.WebGL.Texture:
- autoMipmap, colorspaceConversionPolicy, flipYPolicy, format, height, isReady, magFilter, minFilter, premultuplyAlphaPolicy, width, wrapS, wrapT
- Fields borrowed from class SpiderGL.WebGL.ObjectGL:
- gl, handle, isValid, target
- Fields borrowed from class SpiderGL.Core.ObjectBase:
- uid
Method Summary
Method Attributes | Method Name and Description |
---|---|
setImage(options)
Sets the texture image.
|
|
setSubImage(options)
Sets a region of the texture image.
|
|
<static> |
SpiderGL.WebGL.Texture2D.unbind(gl, unit)
|
- Methods borrowed from class SpiderGL.WebGL.Texture:
- bind
- destroy
- generateMipmap
- getSampler
- setSampler
Class Detail
SpiderGL.WebGL.Texture2D(gl, options)
Creates a SpiderGL.WebGL.Texture2D.
SpiderGL.WebGL.Texture2D is a wrapper for 2D WebGLTexture objects.
- Parameters:
- {WebGLRenderingContext} gl
- A WebGLRenderingContext hijacked with SpiderGL.WebGL.Context.hijack.
- {object} options Optional
- Optional parameters (see SpiderGL.WebGL.Texture constructor).
Method Detail
-
setImage(options)Sets the texture image.
- Parameters:
- {object} options
- The image data and type parameters (see SpiderGL.WebGL.Texture constructor).
- {ArrayBuffer|ArrayBufferView|ImageData|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} options.data Optional
- The texture image pixel data.
- {number} options.internalFormat Optional, Default: SpiderGL.WebGL.Texture.DEFAULT_INTERNAL_FORMAT
- The texture internal format.
- {number} options.level Optional, Default: SpiderGL.WebGL.Texture.DEFAULT_LEVEL
- The texture image mip level.
- {number} options.width Optional
- If data is null or a typed array, specifies the texture image width. If handle is provided, the width parameter will supply the width information, not querable to the WebGLRenderingContext.
- {number} options.height Optional
- If data is null or a typed array, specifies the texture image height. If handle is provided, the width parameter will supply the height information, not querable to the WebGLRenderingContext.
- {number} options.border Optional, Default: SpiderGL.WebGL.Texture.DEFAULT_BORDER
- Texture border.
- {number} options.format Optional, Default: SpiderGL.WebGL.Texture.DEFAULT_FORMAT
- The format parameter used for WebGLRenderingContext.texImage2D.
- {number} options.type Optional, Default: SpiderGL.WebGL.Texture.DEFAULT_TYPE
- The type parameter used for WebGLRenderingContext.texImage2D.
- {bool} options.generateMipmap Optional
- If specified, overrides autoMipmap.
- {bool} options.flipY Optional
- If specified, overrides flipYPolicy.
- {bool} options.premultiplyAlpha Optional
- If specified, overrides premultiplyAlphaPolicy.
- {number} options.colorspaceConversion Optional
- If specified, overrides colorspaceConversionPolicy.
- {function} options.onAbort Optional
- If url is specified, this function will be called if image data loading is aborted.
- {function} options.onError Optional
- If url is specified, this function will be called if an error occurs when loading image data.
- {function} options.onLoad Optional
- If url is specified, this function will be called when image data has been loaded.
- See:
- setSubImage
- SpiderGL.WebGL.Texture
-
setSubImage(options)Sets a region of the texture image.
- Parameters:
- {object} options
- The image data and type parameters (see SpiderGL.WebGL.Texture constructor).
- {ArrayBuffer|ArrayBufferView|ImageData|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} options.data Optional
- The texture sub-image pixel data.
- {number} options.xoffset Optional, Default: SpiderGL.WebGL.Texture.DEFAULT_X_OFFSET
- The sub-image x offset.
- {number} options.yoffset Optional, Default: SpiderGL.WebGL.Texture.DEFAULT_Y_OFFSET
- The sub-image y offset.
- {number} options.width Optional
- If data is null or a typed array, specifies the texture image width. If handle is provided, the width parameter will supply the width information, not querable to the WebGLRenderingContext.
- {number} options.height Optional
- If data is null or a typed array, specifies the texture image height. If handle is provided, the width parameter will supply the height information, not querable to the WebGLRenderingContext.
- {number} options.border Optional, Default: SpiderGL.WebGL.Texture.DEFAULT_BORDER
- Texture border.
- {number} options.format Optional, Default: SpiderGL.WebGL.Texture.DEFAULT_FORMAT
- The format parameter used for WebGLRenderingContext.texSubImage2D.
- {number} options.type Optional, Default: SpiderGL.WebGL.Texture.DEFAULT_TYPE
- The type parameter used for WebGLRenderingContext.texSubImage2D.
- {bool} options.generateMipmap Optional
- If specified, overrides autoMipmap.
- {bool} options.flipY Optional
- If specified, overrides flipYPolicy.
- {bool} options.premultiplyAlpha Optional
- If specified, overrides premultiplyAlphaPolicy.
- {number} options.colorspaceConversion Optional
- If specified, overrides colorspaceConversionPolicy.
- {function} options.onAbort Optional
- If url is specified, this function will be called if image data loading is aborted.
- {function} options.onError Optional
- If url is specified, this function will be called if an error occurs when loading image data.
- {function} options.onLoad Optional
- If url is specified, this function will be called when image data has been loaded.
- See:
- setImage
- SpiderGL.WebGL.Texture
-
<static> SpiderGL.WebGL.Texture2D.unbind(gl, unit)
- Parameters:
- gl
- unit