Skip to main content
Version: Phaser v4.0.0

DynamicTextureHandler

A RenderNode responsible for executing the recorded drawing commands of a DynamicTexture. A DynamicTexture accumulates drawing operations (stamps, repeats, fills, clears, game object draws, callbacks, and captures) into a command buffer. Each time this handler's run method is called, it iterates through that buffer and executes every command against the texture's WebGL framebuffer.

The handler manages all necessary WebGL state during execution: it unbinds the framebuffer's own texture to prevent feedback loops, configures scissor boxes, and creates or releases cloned drawing contexts as blend modes and erase mode change across commands. When a PRESERVE command is not present the command buffer is cleared after rendering, ready for the next frame's drawing calls.

Constructor

new DynamicTextureHandler(manager)

Parameters

nametypeoptionaldescription
managerPhaser.Renderer.WebGL.RenderNodes.RenderNodeManagerNoThe manager that owns this RenderNode.

Scope: static

Extends

Phaser.Renderer.WebGL.RenderNodes.RenderNode

Source: src/renderer/webgl/renderNodes/DynamicTextureHandler.js#L13
Since: 4.0.0

Inherited Members

From Phaser.Renderer.WebGL.RenderNodes.RenderNode:


Public Members

fillRectNode

fillRectNode: Phaser.Renderer.WebGL.RenderNodes.FillRect

Description:

The RenderNode that draws a filled rectangle.

Source: src/renderer/webgl/renderNodes/DynamicTextureHandler.js#L43
Since: 4.0.0


Inherited Methods

From Phaser.Renderer.WebGL.RenderNodes.RenderNode:


Public Methods

run

<instance> run(dynamicTexture)

Description:

Processes the command buffer of the given DynamicTexture and executes each recorded drawing operation against its WebGL framebuffer. This includes stamping textures, tiling sprites, filling rectangles, clearing regions, drawing arbitrary game objects, toggling erase mode, invoking custom callbacks, and capturing game objects to sub-regions. Drawing contexts are cloned and released as blend modes change across commands. After all commands have been executed, the command buffer is cleared unless a PRESERVE command was encountered, and a POST_RENDER camera event is emitted.

Parameters:

nametypeoptionaldescription
dynamicTexturePhaser.Textures.DynamicTextureNoThe DynamicTexture to render.

Overrides: Phaser.Renderer.WebGL.RenderNodes.RenderNode#run

Source: src/renderer/webgl/renderNodes/DynamicTextureHandler.js#L53
Since: 4.0.0