Skip to main content
Texture loads an image file (.png, .jpg, etc.) or raw pixel data into GPU memory so you can draw it with Render.image and Render.imageRounded.
Textures load asynchronously - they may not be ready on the same frame they’re created. Always check isReady before drawing.

Overview

Loading

From file path or raw RGBA pixel data.

Properties

Width, height, readiness, and file path.

Drawing

How to render loaded textures on screen.

Loading

Constructor


Loads an image from a file path. The texture starts loading immediately but may not be ready until a later frame. For SVG files you can optionally specify render dimensions. PNG/JPG images always use the dimensions from the file itself — width and height are ignored.
If neither width nor height is provided for an SVG, it renders at its intrinsic size × 4.
Create textures once outside your render callback - not every frame. Repeated construction causes repeated disk reads and GPU uploads.

Texture.fromMemory


Creates a texture from raw RGBA pixel data in memory. Each pixel is 4 bytes (R, G, B, A). The buffer must contain exactly width × height × 4 bytes.
fromMemory is useful for procedurally generated textures - gradients, noise patterns, or dynamically composited images.

Properties

All properties are read-only.

getSize


Returns both dimensions as a plain object. Convenience method when you need both at once.

toString


Returns a debug string with dimensions, path, and ready state.

Drawing

Textures are drawn using the render module:
See Render.image and Render.imageRounded for full parameter documentation.