gpu-triangle

command
v1.17.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2026 License: BSD-3-Clause Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Command gpu-triangle shows package gpu: a lit cube that turns, drawn by the program's own shader into a gpu.View with a depth buffer and 4x multisampling, inside a Material page. A slider sets the speed of the turn and a switch turns the multisampling on and off. The view draws at every frame (Continuous). The program uses only the public packages: gpu for the device, the buffers and the pipelines, and material for the page. The cube is drawn with Blinn-Phong shading by shaders/cube.wgsl, which `glutter-gen gpushaders` turned into shaders/shaders_gen.go; the matrices come from package vecmath (float64, reversed-Z).

Run it with: go run ./examples/gpu-triangle

It needs a GPU renderer (Vulkan on Linux and Android, Direct3D 12 on Windows, WebGPU on the web). With the OpenGL ES, WebGL or software renderer the view shows its fallback, a line of text.

On Windows: go run ./cmd/glutter-windows run ./examples/gpu-triangle. On the web: go run ./cmd/glutter-web serve ./examples/gpu-triangle. On Android: go run ./cmd/glutter-android run ./examples/gpu-triangle.

In debug builds the L key locks the pointer (the mouse look of a game; SPEC §27.6): the cursor is hidden and the mouse turns the cube. L, Alt+Tab or the end of the lock (Escape on the web) gives the pointer back.

Environment: GLUTTER_BACKEND=x11|wayland (Linux) or win32 (Windows), GLUTTER_RENDERER=vulkan|d3d12|webgpu, GLUTTER_SCREENSHOT=<file.png>, GLUTTER_SCREENSHOT_AFTER=<duration>.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL