Class: TexturePool

TexturePool

Texture pool, used by FilterSystem and plugins.

Stores collection of temporary pow2 or screen-sized renderTextures

If you use custom RenderTexturePool for your filters, you can use methods getFilterTexture and returnFilterTexture same as in default pool

new TexturePool (textureOptions)

Name Type Attributes Description
textureOptions TextureSourceOptions <optional>

options that will be passed to BaseRenderTexture constructor

textureOptions.scaleMode SCALE_MODE <optional>

See SCALE_MODE for possible values.

Members

enableFullScreen boolean

Allow renderTextures of the same size as screen, not just pow2

Automatically sets to true after setScreenSize

Default Value:
  • false

textureOptions TextureSourceOptions

The default options for texture pool

Methods

clear (destroyTextures) void

Clears the pool.

Name Type Attributes Description
destroyTextures boolean <optional>

Destroy all stored textures.

createTexture (pixelWidth, pixelHeight, antialias) Texture

Creates texture with params that were specified in pool constructor.

Name Type Description
pixelWidth number

Width of texture in pixels.

pixelHeight number

Height of texture in pixels.

antialias boolean
Returns:
Type Description
Texture

getOptimalTexture (frameWidth, frameHeight, resolution, antialias) Texture

Gets a Power-of-Two render texture or fullScreen texture

Name Type Default Description
frameWidth number

The minimum width of the render texture.

frameHeight number

The minimum height of the render texture.

resolution number 1

The resolution of the render texture.

antialias boolean
Returns:
Type Description
Texture The new render texture.

getSameSizeTexture (texture, antialias)

Gets extra texture of the same size as input renderTexture

Name Type Default Description
texture Texture

The texture to check what size it is.

antialias boolean false

Whether to use antialias.

Returns:
A texture that is a power of two

returnTexture (renderTexture) void

Place a render texture back into the pool.

Name Type Description
renderTexture Texture

The renderTexture to free