ImGuiTextures

ceramic.ImGuiTextures (Class)

Cross-backend texture bridge between Dear ImGui and ceramic.

ImTextureID values are SMALL INTEGER KEYS into a registry of ceramic.Texture instances - never raw GPU handles or pointers, so the exact same convention works on every target (cpp, js/wasm, c#).

Also implements the Dear ImGui 1.92 dynamic texture protocol (ImGuiBackendFlags_RendererHasTextures): each frame, ImGui may request texture creations/updates/destructions through ImDrawData->Textures (font atlas pages etc.); process() fulfills them with ceramic textures. Partial updates are collapsed into a full submitPixels (the only cross-backend texture update path).

Static Members

imgui
textureId(texture: Texture): imgui.ImTextureID

The ImTextureID for a ceramic texture - use it with ImGui.image() etc. Registers the texture on first use; the slot is released automatically when the texture is destroyed.

Name Type
texture Texture
Returns
imgui.ImTextureID

imgui
textureRef(texture: Texture): imgui.ImTextureRef

An ImTextureRef for a ceramic texture - this is what ImGui.image(), ImGui.imageButton() etc. take as first argument.

Name Type
texture Texture
Returns
imgui.ImTextureRef

imgui
texture(id: imgui.ImTextureID): Texture

The ceramic texture for an ImTextureID key (null if unknown).

Name Type
id imgui.ImTextureID
Returns
Texture

imgui
allTextures(): Array<Texture>

Every registered texture (for Renderable.computeUsedTextures).

Returns
Array<Texture>

imgui
process(drawData: ceramic._ImGuiTextures.DDPtr): Void

Fulfill this frame's ImTextureData requests (called by the renderable, right before walking the draw lists).

Name Type
drawData ceramic._ImGuiTextures.DDPtr

Private Members

imgui
textures: Array<Texture>

id → texture. Index 0 is reserved (ImTextureID_Invalid == 0).


imgui
owned: Map

Textures created by the ImTextureData protocol (owned here).


imgui
allocSlot(texture: Texture): Int
Name Type
texture Texture
Returns
Int

imgui
release(id: Int): Void
Name Type
id Int

imgui
createFromTextureData(td: ceramic._ImGuiTextures.TDPtr): Texture
Name Type
td ceramic._ImGuiTextures.TDPtr
Returns
Texture

imgui
pixelsFromTextureData(td: ceramic._ImGuiTextures.TDPtr): UInt8Array

Copy the RGBA pixels out of an ImTextureData, PREMULTIPLYING alpha (ceramic's whole pipeline is premultiplied; ImGui atlases are straight alpha - uploading them raw makes empty texels add pure white with our ONE / ONE_MINUS_SRC_ALPHA blending). Converts Alpha8 when needed.

Name Type
td ceramic._ImGuiTextures.TDPtr
Returns
UInt8Array

Metadata

Name Parameters
:hxGen -