Texture

Texture

Methods

copyFrom

DOC_TBA

Parameters:
Name Type Description
source Object The source {ImageData}, {HTMLImageElement}, {HTMLCanvasElement}, or {HTMLVideoElement}.
xOffset Number optional
yOffset Number optional
Throws:
  • DeveloperError : Cannot call copyFrom when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.
  • DeveloperError : source is required.
  • DeveloperError : xOffset must be greater than or equal to zero.
  • DeveloperError : yOffset must be greater than or equal to zero.
  • DeveloperError : xOffset + source.width must be less than or equal to getWidth().
  • DeveloperError : yOffset + source.height must be less than or equal to getHeight().
  • DeveloperError : This texture was destroyed, i.e., destroy() was called.

copyFromFramebuffer

DOC_TBA

Parameters:
Name Type Description
xOffset Number optional
yOffset Number optional
framebufferXOffset Number optional
framebufferYOffset Number optional
width Number optional
height Number optional
Throws:
  • DeveloperError : Cannot call copyFromFramebuffer when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.
  • DeveloperError : This texture was destroyed, i.e., destroy() was called.
  • DeveloperError : xOffset must be greater than or equal to zero.
  • DeveloperError : yOffset must be greater than or equal to zero.
  • DeveloperError : framebufferXOffset must be greater than or equal to zero.
  • DeveloperError : framebufferYOffset must be greater than or equal to zero.
  • DeveloperError : xOffset + source.width must be less than or equal to getWidth().
  • DeveloperError : yOffset + source.height must be less than or equal to getHeight().

destroy

Destroys the WebGL resources held by this object. Destroying an object allows for deterministic release of WebGL resources, instead of relying on the garbage collector to destroy this object.

Once an object is destroyed, it should not be used; calling any function other than isDestroyed will result in a DeveloperError exception. Therefore, assign the return value (undefined) to the object as done in the example.

Throws:
DeveloperError : This texture was destroyed, i.e., destroy() was called.
Returns:
Example
texture = texture && texture.destroy();
See:

generateMipmap

DOC_TBA

Parameters:
Name Type Description
hint MipmapHint optional.
Throws:
  • DeveloperError : Cannot call generateMipmap when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.
  • DeveloperError : hint is invalid.
  • DeveloperError : This texture's width must be a power of two to call generateMipmap().
  • DeveloperError : This texture's height must be a power of two to call generateMipmap().
  • DeveloperError : This texture was destroyed, i.e., destroy() was called.

getDimensions

DOC_TBA

Throws:
DeveloperError : This texture was destroyed, i.e., destroy() was called.

getFlipY

Returns true if the source pixels are flipped vertically when the texture is created or updated, i.e., UNPACK_FLIP_Y_WEBGL is used.

Throws:
DeveloperError : This texture was destroyed, i.e., destroy() was called.
Returns:
Boolean True if the source pixels are flipped vertically; otherwise, false.

getHeight

DOC_TBA

Throws:
DeveloperError : This texture was destroyed, i.e., destroy() was called.

getPixelDatatype

DOC_TBA

Throws:
DeveloperError : This texture was destroyed, i.e., destroy() was called.

getPixelFormat

DOC_TBA

Throws:
DeveloperError : This texture was destroyed, i.e., destroy() was called.

getPreMultiplyAlpha

DOC_TBA

Throws:
DeveloperError : This texture was destroyed, i.e., destroy() was called.

getSampler

DOC_TBA

Throws:
DeveloperError : This texture was destroyed, i.e., destroy() was called.

getWidth

DOC_TBA

Throws:
DeveloperError : This texture was destroyed, i.e., destroy() was called.

isDestroyed

Returns true if this object was destroyed; otherwise, false.

If this object was destroyed, it should not be used; calling any function other than isDestroyed will result in a DeveloperError exception.

Returns:
Boolean True if this object was destroyed; otherwise, false.
See:

setSampler

Sets the sampler to use when sampling this texture.

Parameters:
Name Type Argument Description
sampler <optional>
The sampler to use. Create a sampler by calling Context#createSampler. If this parameter is not specified, a default sampler is used. The default sampler clamps texture coordinates in both directions, uses linear filtering for both magnification and minifcation, and uses a maximum anisotropy of 1.0.
Throws:
DeveloperError : This texture was destroyed, i.e., destroy() was called.
See: