RBGL

Pure Ruby software renderer

A graphics pipeline you can read.

Define a graphics pipeline in Ruby, rasterize it in software, and present native or headless frames.

gem install rbgl

Frame 00000 · PPMvertex → fragment → raster

Keep every stage in view.

Connect typed vertex data, Ruby shader blocks, rasterization, and portable output.

01

Shape the pipeline

Describe layouts and shader stages with Ruby blocks.

02

Rasterize in software

Draw triangles, lines, and points with depth and alpha blending.

03

Present anywhere

Use Cocoa, Wayland, X11, or headless file output.

A small first step

Start with one example.

Install the gem, then follow the project guide for platform requirements and the full API.

Read the installation guide ↗

require "rbgl"

window = RBGL::GUI::Window.new(
  width: 160, height: 120, backend: :file,
  output_dir: "frames", format: :ppm,
  max_frames: 1, target_fps: nil
)

# Define pipeline and vertices as shown in the guide.
window.run do |context, _delta_time|
  context.bind_pipeline(pipeline)
  context.bind_vertex_buffer(vertices)
  context.draw_arrays(:triangles, 0, 3)
end