reckfellENGINE

DrawableTexture2D

Texture2D with explicit GPU write operations.

On this page
class DrawableTexture2DReckfellSharpInherits Texture2D

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
# DrawableTexture2D
C#
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
# BlitRect
C#
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.

Parameters
NameTypeDefault
rectRect2I—
sourceTexture2D—
modulateColor?default
mipmapint0
materialMaterialnull
rect

Destination rectangle in base-size coordinates, even for mipmap writes; not a source crop.

source

Source Texture2D, or null for white. AtlasTexture is unsupported by the resource call.

modulate

Color passed as MODULATE, not a channel mask. Apply it explicitly in a custom shader.

mipmap

An allocated destination level; 0 is the base.

material

BlitMaterial or texture_blit ShaderMaterial; null selects built-in blend_mix.

BlitRectMultivoid
# BlitRectMulti
C#
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.

Parameters
NameTypeDefault
rectRect2I—
sourcesReckfell.Collections.Array<Texture2D>—
extraTargetsReckfell.Collections.Array<DrawableTexture2D>—
modulateColor?default
mipmapint0
materialMaterialnull
rect

Shared destination rectangle in all targets base coordinates.

sources

1–4 sources in hint_blit_source0 through 3 order.

extraTargets

0–3 additional initialized DrawableTexture2D targets; do not include this texture.

modulate

Operation shader MODULATE value.

mipmap

One allocated destination level shared by all targets.

material

A texture_blit material; null uses the built-in material.

GenerateMipmapsvoid
# GenerateMipmaps
C#
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
# GetUseMipmaps
C#
public bool GetUseMipmaps();

Returns the stored setting, not a GPU allocation query. After SetUseMipmaps(true) alone, physical levels can remain absent until Setup.

Returns bool

Stored useMipmaps bool.

SetFormatvoid
# SetFormat
C#
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.

Parameters
NameTypeDefault
formatDrawableTexture2D.DrawableFormat—
format

Requested resource DrawableFormat setting.

SetUseMipmapsvoid
# SetUseMipmaps
C#
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.

Parameters
NameTypeDefault
mipmapsbool—
mipmaps

Requested flag; the setter alone does not allocate a mipmap chain.

Setupvoid
# Setup
C#
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.

Parameters
NameTypeDefault
widthint—
heightint—
formatDrawableTexture2D.DrawableFormat—
colorColor?default
useMipmapsboolfalse
width

Width from 1 through 16384.

height

Height from 1 through 16384.

format

DrawableFormat; the example is checked with Rgba8.

color

Initial color; null/omitted means white, not transparent.

useMipmaps

true allocates a mipmap chain for subsequent writes/generation.

DrawableTexture2D.DrawableFormat

ValueDescription
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.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.