Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
B

beamterm

> 编程语言
Open source

A sub-millisecond terminal text rendering system for WebGL2 and OpenGL 3.3

198 stars0 likes1 views
WebsiteGitHub

About

A sub-millisecond terminal text rendering system for WebGL2 and OpenGL 3.3

beamterm - A GPU-Accelerated Terminal Renderer

Crate Badge NPM Badge API Badge Core API Badge Deps.rs
Badge DeepWiki Badge

A high-performance terminal rendering library targeting sub-millisecond render times, supporting both WebGL2 and OpenGL 3.3 from a single Rust codebase. beamterm is a terminal renderer, not a full terminal emulator - it handles the display layer while you provide the terminal logic (see the terminal emulator example for a demo of a working terminal that outperforms several established emulators in rendering throughput). It also powers Ratzilla's WebGL2 backend. The included terminal emulator example running with a dynamic font atlas (Hack + Noto Color Emoji).

Live Demos

Check out interactive examples showcasing both pure WASM applications and JavaScript/TypeScript integrations.

Key Features

  • Cross-Platform GL - Single rendering core targeting WebGL2 (WASM) and OpenGL 3.3 (native) via glow
  • Single Draw Call - Renders entire terminal (e.g., 200×80 cells) in one instanced draw
  • Flexible Font Atlases - Static pre-generated atlases or dynamic on-demand rasterization with LRU caching
  • Unicode and Emoji Support - Complete Unicode support with grapheme clustering
  • Selection Support (WASM) - Mouse-driven text selection with clipboard integration (Block/Linear modes)
  • Optional JS/TS Bindings (WASM) - Provides a JavaScript/TypeScript API for easy integration

Performance

beamterm targets sub-millisecond render times across a wide range of hardware. The following measurements were taken in Chrome (WebGL2/WASM):

Metric Target (Low-end) Achieved (2019 hardware)
Render Time† = ...;
terminal.update_cells(cells.into_iter())?;
terminal.render_frame()?;

// Handle resize terminal.resize(new_width, new_height)?;


### Selection and Mouse Input

The renderer supports mouse-driven text selection with automatic clipboard integration:

```rust
// Enable selection handler with options
let terminal = Terminal::builder("#canvas")
    .mouse_selection_handler(
        MouseSelectOptions::new()
            .selection_mode(SelectionMode::Linear)
            .trim_trailing_whitespace(true),
    )
    .build()?;

// Or implement custom mouse handling
let terminal = Terminal::builder("#canvas")
    .mouse_input_handler(|event, grid| {
        // Custom handler logic
    })
    .build()?;

…

rust
// Static atlas (default, or with custom atlas)
let terminal = Terminal::builder("#canvas").build()?;
let terminal = Terminal::builder("#canvas")
    .font_atlas(FontAtlasData::from_binary(include_bytes!("custom.atlas"))?)
    .build()?;

// Dynamic atlas (WASM)
let terminal = Terminal::builder("#canvas")
    .dynamic_font_atlas(&["JetBrains Mono", "Fira Code"], 16.0)
    .build()?;

// Switch atlas at runtime (WASM)
terminal.replace_with_dynamic_atlas(&["Hack", "Fira Code"], 14.0)?;
terminal.replace_with_static_atlas(new_atlas_data)?;

Atlas Usage: Native OpenGL 3.3

Native dynamic atlas usage (requires native-dynamic-atlas feature on beamterm-core):

rust
use beamterm_core::{NativeGlyphRasterizer, gl::DynamicFontAtlas};

let effective_font_size = 16.0 * pixel_ratio;
let rasterizer = NativeGlyphRasterizer::new(
    &["Hack Nerd Font Mono", "Hack", "Noto Color Emoji"],
    effective_font_size,
)?;
let atlas = DynamicFontAtlas::new(&gl, rasterizer, 16.0, pixel_ratio)?;
let mut grid = TerminalGrid::new(&gl, atlas.into(), size, pixel_ratio, &GlslVersion::Gl330)?;

…


layer = slot / 32
position = slot % 32

…


Byte Layout: [0][1][2][3][4][5][6][7]
              └┬─┘  └──┬──┘  └──┬──┘
           Glyph ID  FG RGB   BG RGB
           (16-bit) (24-bit) (24-bit)

…

toml
[dependencies]
beamterm-core = "0.15"
glow = "0.16"

Any crate that provides a glow::Context works - glutin, sdl2, glfw, etc.

Development Setup (WASM)

bash
# Install Rust toolchain
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup target add wasm32-unknown-unknown

# Install tools
cargo install wasm-pack trunk

Running the Examples

Native OpenGL 3.3 examples run directly with cargo:

bash
# Simple terminal rendering demo (glutin + winit)
cargo run -p native-terminal

# Terminal emulator with PTY support (vt100 + portable-pty)
cargo run -p terminal-emulator

# Semi-transparent terminal overlay on a 3D spinning cube
cargo run -p game-console

# Run with dynamic font atlas (rasterizes system fonts at runtime)
cargo run -p native-terminal --features dynamic

WASM/browser examples require Trunk:

bash
# Wave interference effect (ratzilla + tachyonfx)
cd examples/canvas_waves && trunk serve

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rustopenglopengl-libraryterminalwasm

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言