class
Tessell::Render::GL::GLBackend
- Tessell::Render::GL::GLBackend
- Tessell::Render::Backend
- Reference
- Object
Defined in:
tessell/render/gl/gl_backend.crConstructors
Instance Method Summary
- #begin_frame(dirty : Array(Tessell::Rect) | Nil = nil, theme : Tessell::Render::Theme = Tessell::Render::Theme.light) : Nil
- #close : Nil
-
#create_texture(width : Int32, height : Int32, pixels : Bytes) : Int32
---- 外部纹理生命周期(issue #45/#28)---- pixels 为 straight RGBA8;上传保持 straight,绘制 Image 命令时 临时切换 blend 为 straight-alpha 语义(见 draw_image_cmd)。
- #delete_textures : Nil
-
#destroy_texture(handle : Int32) : Nil
销毁外部纹理;handle 失效后再绘制 Image 命令属应用层错误。
-
#draw_draw_list(list : Tessell::Render::DrawList, from : Int32 = 0, count : Int32 = -1) : Int32
Draw Kit/core primitive commands.
-
#draw_polygon(points : Array(Tessell::Point), color : UInt32, even_odd : Bool = true) : Bool
Fill a polygon using stencil/cover when supported (e.g.
-
#draw_text(vertices : Array(Tessell::Render::Vertex), batches : Array(Tessell::Render::TextBatch), batch_count : Int32 = batches.size, from_batch : Int32 = 0, clip : Tessell::Rect | Nil = nil) : Int32
Issue #15 contract: text is part of the command order — a host may draw text segments interleaved with draw_draw_list segments.
- #end_frame : Nil
- #init(width : Int32, height : Int32) : Nil
- #page_texture_ids : Array(Int32)
- #resize(width : Int32, height : Int32) : Nil
-
#resolved_texture(page : Int32, color : Bool) : Int32
Color batches resolve RGBA pages; gray batches resolve R8 pages.
- #resolved_texture(page : Int32) : Int32
-
#resolved_texture_external(handle : Int32) : Int32
返回 GL texture name(宿主可据此判断支持;0 = handle 不存在)。
- #set_clear_color(r : Float32, g : Float32, b : Float32, a : Float32 = 1.0_f32) : Nil
- #stats : Tessell::Render::FrameStats
- #stencil_bits : Int32
-
#sync_atlas(atlas : Tessell::Text::GlyphAtlas) : Nil
全量重传 glyph atlas 所有页(冷启动/整体重建用)。动态文本场景禁止 每帧调用——增量路径走 sync_atlas_dirty(issue #22)。
-
#sync_atlas_dirty(atlas : Tessell::Text::GlyphAtlas) : Nil
Incremental atlas upload (issue #1): uploads only pages whose content revision changed since the last sync (new pages get their first upload; updated pages use glTexSubImage2D over the whole page).
-
#update_texture(handle : Int32, x : Int32, y : Int32, width : Int32, height : Int32, pixels : Bytes) : Nil
增量区域上传(GL 走 glTexSubImage2D 同型链路)。基类 no-op。
Instance methods inherited from class Tessell::Render::Backend
begin_frame(dirty : Array(Tessell::Rect) | Nil = nil, theme : Tessell::Render::Theme = Tessell::Render::Theme.light) : Nil
begin_frame,
close : Nil
close,
create_texture(width : Int32, height : Int32, pixels : Bytes) : Int32
create_texture,
destroy_texture(handle : Int32) : Nil
destroy_texture,
draw_draw_list(list : Tessell::Render::DrawList, from : Int32 = 0, count : Int32 = -1) : Int32
draw_draw_list,
draw_polygon(points : Array(Tessell::Point), color : UInt32, even_odd : Bool = true) : Bool
draw_polygon,
draw_text(vertices : Array(Vertex), batches : Array(TextBatch), batch_count : Int32 = batches.size, from_batch : Int32 = 0, clip : Tessell::Rect | Nil = nil) : Int32
draw_text,
end_frame : Nil
end_frame,
init(width : Int32, height : Int32) : Nil
init,
resize(width : Int32, height : Int32) : Nil
resize,
resolved_texture(page : Int32, color : Bool) : Int32resolved_texture(page : Int32) : Int32 resolved_texture, resolved_texture_external(handle : Int32) : Int32 resolved_texture_external, stats : FrameStats stats, sync_atlas(atlas : Text::GlyphAtlas) : Nil sync_atlas, sync_atlas_dirty(atlas : Text::GlyphAtlas) : Nil sync_atlas_dirty, update_texture(handle : Int32, x : Int32, y : Int32, width : Int32, height : Int32, pixels : Bytes) : Nil update_texture
Class methods inherited from class Tessell::Render::Backend
text_batch_end(size : Int32, batch_count : Int32, from_batch : Int32) : Int32
text_batch_end
Constructor Detail
Instance Method Detail
---- 外部纹理生命周期(issue #45/#28)---- pixels 为 straight RGBA8;上传保持 straight,绘制 Image 命令时 临时切换 blend 为 straight-alpha 语义(见 draw_image_cmd)。
销毁外部纹理;handle 失效后再绘制 Image 命令属应用层错误。
Draw Kit/core primitive commands. Colors are 0xRRGGBBAA, alpha-premultiplied before submit because begin_frame uses (GL_ONE, GL_ONE_MINUS_SRC_ALPHA). Text commands are skipped: text is submitted by draw_text with atlas batches, allowing a host to interleave shape/text segments in command order (issue #15). Returns non-text commands submitted; clip is applied per command.
Fill a polygon using stencil/cover when supported (e.g. GLBackend). points
are in screen space, color is premultiplied RGBA8, and even_odd selects
fill rule (true = even-odd). Base returns false = unsupported; backends that
perform the fill must return true and account stencil_fills in stats.
Issue #15 contract: text is part of the command order — a host may draw
text segments interleaved with draw_draw_list segments. from_batch
selects the unsubmitted suffix of batches; clip restricts the text
segment to a scissor rect (nil = unclipped).
Return value = quads submitted by THIS call (delta, issue #46);
stats.submitted_quads is the FRAME cumulative total (reset only in
begin_frame) — interleaved submissions accumulate, never reset.
Color batches resolve RGBA pages; gray batches resolve R8 pages.
返回 GL texture name(宿主可据此判断支持;0 = handle 不存在)。
全量重传 glyph atlas 所有页(冷启动/整体重建用)。动态文本场景禁止 每帧调用——增量路径走 sync_atlas_dirty(issue #22)。
Incremental atlas upload (issue #1): uploads only pages whose content revision changed since the last sync (new pages get their first upload; updated pages use glTexSubImage2D over the whole page). Cheap to call every frame — no-op when the atlas has not changed.
增量区域上传(GL 走 glTexSubImage2D 同型链路)。基类 no-op。