render-textures

Draw game objects to off-screen RenderTexture and DynamicTexture surfaces in Phaser 4.

Updated May 7, 2021
One-click install
npx skills add https://github.com/travispwingo/travispwingo.github.io --skill render-textures-travispwingo
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: render-textures
Source: https://github.com/travispwingo/travispwingo.github.io/tree/main/mario/docs/skills/render-textures
Command: npx skills add https://github.com/travispwingo/travispwingo.github.io --skill render-textures-travispwingo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Phaser 4's texture-drawing API uses a command buffer that requires explicit render() calls, and choosing between RenderTexture, DynamicTexture, and Stamp is confusing. This Skill provides correct patterns for off-screen rendering, snapshots, and procedural texture generation. ## Core Features & Use Cases - RenderTexture and DynamicTexture workflows: Draw sprites, groups, containers, and texture keys to off-screen surfaces with draw(), stamp(), capture(), fill(), erase(), and repeat(). - Command buffer management: Explains render(), preserve(), renderMode ('render', 'redraw', 'all'), and callback insertion so content actually appears. - Snapshots and procedural generation: Capture pixel data via snapshot(), snapshotArea(), and snapshotPixel(), and build generated textures like starfields and minimaps. - Use Case: Build a fixed-position minimap by creating a RenderTexture with setScrollFactor(0), renderMode 'all', and capture() calls that draw scaled-down world objects each frame. ## Quick Start Ask the AI to create a Phaser 4 RenderTexture that draws a sprite to an off-screen texture and displays it in the scene.

Frequently Asked Questions about render-textures

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I draw a sprite to a RenderTexture in Phaser 4?▼

Create one with this.add.renderTexture(x, y, w, h), call rt.draw(sprite, x, y), then call rt.render() to flush the command buffer. Nothing appears until render() executes the buffered commands.

What is the difference between RenderTexture and DynamicTexture in Phaser?▼

RenderTexture is a visible Image game object with its own DynamicTexture, created via this.add.renderTexture(). DynamicTexture lives in the Texture Manager, is shared by key across scenes and objects, but is not visible until assigned to a game object.

Why is my RenderTexture blank after calling draw in Phaser 4?▼

Phaser 4 buffers draw commands instead of executing them immediately. You must call render() to flush the buffer, or set renderMode to 'redraw' or 'all' so rendering happens automatically each frame.

How do I take a screenshot or snapshot of a Phaser texture?▼

Use rt.snapshot(callback) for the full texture, snapshotArea(x, y, w, h, callback) for a region, or snapshotPixel(x, y, callback) for one pixel. Snapshots use readPixels and block the GPU, so avoid calling them every frame.

Does resizing a RenderTexture keep its existing content?▼

No. Calling resize() destroys and recreates the framebuffer, erasing all content. Dimensions are also rounded up to even numbers by default unless you pass false for the forceEven parameter.

When should I use DynamicTexture instead of RenderTexture?▼

Use DynamicTexture when multiple game objects share one generated texture, when you need cross-scene access by key, or when the texture feeds masks or shaders. Use RenderTexture for a single visible drawable surface.