LogoPixi’VN
pixi-jsClasses

Class: TexturePoolClass

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/TexturePool.d.ts:15

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

Advanced

Constructors

Constructor

> new TexturePoolClass(textureOptions?): TexturePoolClass

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/TexturePool.d.ts:33

Parameters

textureOptions?

TextureSourceOptions<any>

options that will be passed to BaseRenderTexture constructor

Returns

TexturePoolClass

Properties

enableFullScreen

> enableFullScreen: boolean

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/TexturePool.d.ts:26

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

Automatically sets to true after setScreenSize

Default

false

textureOptions

> textureOptions: TextureSourceOptions

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/TexturePool.d.ts:17

The default options for texture pool


textureStyle

> textureStyle: TextureStyle

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/TexturePool.d.ts:19

The default texture style for the pool

Methods

clear()

> clear(destroyTextures?): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/TexturePool.d.ts:79

Clears the pool.

Parameters

destroyTextures?

boolean

Destroy all stored textures.

Returns

void


createTexture()

> createTexture(pixelWidth, pixelHeight, antialias, autoGenerateMipmaps): Texture

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/TexturePool.d.ts:41

Creates texture with params that were specified in pool constructor.

Parameters

pixelWidth

number

Width of texture in pixels.

pixelHeight

number

Height of texture in pixels.

antialias

boolean

autoGenerateMipmaps

boolean

Whether to automatically generate mipmaps for this texture

Returns

Texture


getOptimalTexture()

> getOptimalTexture(frameWidth, frameHeight, resolution, antialias, autoGenerateMipmaps?): Texture

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/TexturePool.d.ts:51

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

Parameters

frameWidth

number

The minimum width of the render texture.

frameHeight

number

The minimum height of the render texture.

resolution

number

The resolution of the render texture.

antialias

boolean

autoGenerateMipmaps?

boolean

Whether to automatically generate mipmaps. Defaults to false.

Returns

Texture

The new render texture.


getSameSizeTexture()

> getSameSizeTexture(texture, antialias?): Texture<TextureSource<any>>

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/TexturePool.d.ts:62

Gets a pooled texture matching the dimensions and resolution of the given texture.

This is a convenience wrapper around getOptimalTexture that copies width, height, and resolution from an existing texture. Useful when a filter needs a temporary texture the same size as its input (e.g., for multi-pass blur).

Parameters

texture

Texture

The texture whose dimensions to match.

antialias?

boolean

Whether to use antialias on the pooled texture. Defaults to false.

Returns

Texture<TextureSource<any>>

A pooled texture with power-of-two backing dimensions at the source resolution.


returnTexture()

> returnTexture(renderTexture, resetStyle?): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/TexturePool.d.ts:74

Returns a texture to the pool so it can be reused by future getOptimalTexture or getSameSizeTexture calls.

If you modified the texture's style after obtaining it (e.g., changed filtering or wrapping), pass resetStyle = true to restore the pool's default textureStyle. This prevents style changes from leaking into subsequent consumers of the same pooled texture.

Parameters

renderTexture

Texture

The texture to return to the pool.

resetStyle?

boolean

When true, replaces the texture source's style with the pool default. Defaults to false.

Returns

void