DrawableTexture2D
Texture2D with explicit GPU write operations.
Initialize with Setup and modify through BlitRect/BlitRectMulti. Contents do not automatically refresh when a material changes. Can be assigned to TextureRect/Sprite2D and read using GetImage; GPU readback has a cost.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
DrawableTexture2DConstructor
public DrawableTexture2D();Creates a DrawableTexture2D resource. Call Setup before writing: the constructor does not allocate target storage. Metadata dimensions or a placeholder RID do not prove drawable storage is initialized.
Methods7
BlitRectvoid
public void BlitRect(Rect2I rect, Texture2D source, Color? modulate = default, int mipmap = 0, Material material = null);Performs one GPU write into the destination rectangle, scaling the entire source into it. The material belongs to the operation, not a persistent effect. With no material, blend_mix is used; a custom texture_blit without render_mode uses blend_disabled. The source cannot alias the destination.
| Name | Type | Default |
|---|---|---|
rect | Rect2I | — |
source | Texture2D | — |
modulate | Color? | default |
mipmap | int | 0 |
material | Material | null |
rectDestination rectangle in base-size coordinates, even for mipmap writes; not a source crop.
sourceSource Texture2D, or null for white. AtlasTexture is unsupported by the resource call.
modulateColor passed as MODULATE, not a channel mask. Apply it explicitly in a custom shader.
mipmapAn allocated destination level; 0 is the base.
materialBlitMaterial or texture_blit ShaderMaterial; null selects built-in blend_mix.
BlitRectMultivoid
public void BlitRectMulti(Rect2I rect, Reckfell.Collections.Array<Texture2D> sources, Reckfell.Collections.Array<DrawableTexture2D> extraTargets, Color? modulate = default, int mipmap = 0, Material material = null);One operation with 1–4 sources and 1–4 destinations including this texture. Destinations need equal dimensions and the requested mipmap. Do not alias sources/destinations or repeat output resources. COLOR0 writes this texture and COLOR1 through COLOR3 write extras; bound but unwritten RD outputs become opaque black.
| Name | Type | Default |
|---|---|---|
rect | Rect2I | — |
sources | Reckfell.Collections.Array<Texture2D> | — |
extraTargets | Reckfell.Collections.Array<DrawableTexture2D> | — |
modulate | Color? | default |
mipmap | int | 0 |
material | Material | null |
rectShared destination rectangle in all targets base coordinates.
sources1–4 sources in hint_blit_source0 through 3 order.
extraTargets0–3 additional initialized DrawableTexture2D targets; do not include this texture.
modulateOperation shader MODULATE value.
mipmapOne allocated destination level shared by all targets.
materialA texture_blit material; null uses the built-in material.
GenerateMipmapsvoid
public void GenerateMipmaps();Regenerates lower levels from the base, replacing their previous contents including manual writes. Allocate the chain using Setup(useMipmaps:true). An ordinary blit does not automatically keep it current.
GetUseMipmapsbool
public bool GetUseMipmaps();Returns the stored setting, not a GPU allocation query. After SetUseMipmaps(true) alone, physical levels can remain absent until Setup.
boolStored useMipmaps bool.
SetFormatvoid
public void SetFormat(DrawableTexture2D.DrawableFormat format);Changes the resource format setting without reallocating existing GPU storage. Call Setup with the intended DrawableFormat to change actual storage; this resets contents.
| Name | Type | Default |
|---|---|---|
format | DrawableTexture2D.DrawableFormat | — |
formatRequested resource DrawableFormat setting.
SetUseMipmapsvoid
public void SetUseMipmaps(bool mipmaps);Changes the mipmaps flag without allocating levels in existing storage. Call Setup with useMipmaps=true for an actual chain. The flag getter does not prove levels exist.
| Name | Type | Default |
|---|---|---|
mipmaps | bool | — |
mipmapsRequested flag; the setter alone does not allocate a mipmap chain.
Setupvoid
public void Setup(int width, int height, DrawableTexture2D.DrawableFormat format, Color? color = default, bool useMipmaps = false);Allocates or recreates storage with the requested size, format, color and mipmap chain. Repeated calls reset contents; tested RD retains the resource RID. Explicitly pass Colors.Transparent for a transparent canvas. Dimensions 1–16384 are the API bound, not a GPU memory-budget guarantee.
| Name | Type | Default |
|---|---|---|
width | int | — |
height | int | — |
format | DrawableTexture2D.DrawableFormat | — |
color | Color? | default |
useMipmaps | bool | false |
widthWidth from 1 through 16384.
heightHeight from 1 through 16384.
formatDrawableFormat; the example is checked with Rgba8.
colorInitial color; null/omitted means white, not transparent.
useMipmapstrue allocates a mipmap chain for subsequent writes/generation.
DrawableTexture2D.DrawableFormat
| Value | Description |
|---|---|
Rgba8 = 0 | OpenGL texture format RGBA with four components, each with a bitdepth of 8. |
Rgba8Srgb = 1 | OpenGL texture format RGBA with four components, each with a bitdepth of 8. When drawn to, an sRGB to linear color space conversion is performed. |
Rgbaf = 3 | OpenGL texture format GL_RGBA32F where there are four components, each a 32-bit floating-point value. |
Rgbah = 2 | OpenGL texture format GL_RGBA16F where there are four components, each a 16-bit "half-precision" floating-point value. |