Render-target texture wrapper with cached access to 1D, 2D, and 3D graphics contexts.

Texture is a lightweight abstraction over kha.Image for render targets. It is commonly used as an intermediate buffer, post-processing target, or off-screen drawing surface.

Typical usage:

var target = new Texture(512, 512);
target.context2D.begin();
// draw into the texture
target.context2D.end();

Static variables

staticread onlycontext1D:Context1D

1D graphics context for this texture.

Use this when you need low-level access to the 1D drawing API exposed by Kha.

staticread onlycontext2D:Context2D

2D graphics context for this texture.

This is the most common entry point when drawing UI, sprites, and text into an off-screen target.

staticread onlycontext3D:Context3D

3D graphics context for this texture.

Use this for custom GPU rendering passes targeting the texture.

Static methods

staticinlinegenerateMipmaps(this:Image, levels:Int):Void

staticinlinesetDepthStencilFrom(this:Image, image:Image):Void

Reuses the depth/stencil buffer from another image.

This is useful when multiple render targets should share depth/stencil data within the same rendering pipeline.

Parameters:

image

Source image providing the depth/stencil attachment.