Class: Texture

Texture(gl, image, wrapMode)

Represents a WebGL texture. Applications typically do not interact with this class.

Constructor

new Texture(gl, image, wrapMode)

Constructs a texture for a specified image.
Parameters:
Name Type Description
gl WebGLRenderingContext The current WebGL rendering context.
image Image The texture's image.
wrapMode GLenum Optional. Specifies the wrap mode of the texture. Defaults to gl.CLAMP_TO_EDGE
Source:
Throws:
If the specified WebGL context or image is null or undefined.
Type
ArgumentError

Members

creationTime :Date

The time at which this texture was created.
Type:
  • Date
Source:

Methods

applyTexParameters(dc)

Applies the configured texture parameters to the OpenGL context.
Parameters:
Name Type Description
dc DrawContext The current draw context.
Source:

bind(dc)

Binds this texture in the current WebGL graphics context.
Parameters:
Name Type Description
dc DrawContext The current draw context.
Source:

clearTexParameters()

Clears the list of texture parameters to apply when binding this texture.
Source:

dispose(gl)

Disposes of the WebGL texture object associated with this texture.
Parameters:
Name Type Description
gl
Source:

getTexParameter(name) → {GLint}

Returns the value of a texture parameter to be assigned to this texture.
Parameters:
Name Type Description
name Glenum The name of the parameter
Source:
Returns:
The value for this parameter
Type
GLint

resizeImage(image)

Resizes an image to a power of two.
Parameters:
Name Type Description
image Image The image to resize.
Source:

setTexParameter(name, value)

Sets a texture parameter to apply when binding this texture. Currently only gl.TEXTURE_MAG_FILTER has an effect.
Parameters:
Name Type Description
name Glenum The name of the parameter
value GLint The value for this parameter
Source: