globes of hexagon grids drawn on the graphics card
hexglobe draws the interactive globes of hexify, such as a hexagon grid over the continents, as PNG images from R, with no browser.
A globe from hexify::hex_globe() is an HTML widget that draws itself
in the browser through WebGPU. hexglobe draws the same globe offscreen
on the graphics card through wgpu, the Rust
implementation of WebGPU, with the widget’s own shader and pipelines,
and returns the image as pixels or a PNG file. hexify calls it from
hex_globe_png(), so you can save globes from a script or a report and
choose their size in pixels.
hexglobe supports:
hexify::hex_globe_png() renders a globe
widget to a PNG file, and a globe takes a few hundredths of a second
once the graphics device is open.gpu_adapter() names the graphics card in
use.render_scene() returns the pixels as red, green,
blue and alpha bytes, and write_png() and read_png() move them to
and from PNG files.The image matches the widget’s to within the anti-aliasing of edges, because both run the same shader and pipelines.
hexglobe compiles Rust code. Install the build tools for your operating system first:
| Operating system | Build tools |
|---|---|
| Windows | Rtools matching your R version |
| macOS | Run xcode-select --install in Terminal |
| Debian / Ubuntu | Install r-base-dev
|
| All | Rust’s cargo and rustc, from rustup
|
On Windows, add the Rust target that R’s toolchain links against:
rustup target add x86_64-pc-windows-gnu
Check that R can find the compiler:
pkgbuild::has_build_tools(debug = TRUE)
Then install hexglobe:
# install.packages("pak")
# pak::pak("gcol33/hexglobe")
install.packages("hexglobe", repos = c('https://gcol33.r-universe.dev', 'https://cloud.r-project.org'))
The build runs cargo to compile the Rust library with wgpu and its
other Rust dependencies. On macOS the package links against Apple’s
Metal, QuartzCore and CoreGraphics frameworks, and on Linux against the
dynamic loader and threads libraries.
hexify::hex_grid() and a globe widget with
hexify::hex_globe().hexify::hex_globe_png(), which
draws it through hexglobe.gpu_adapter().library(hexify)
grid <- hex_grid(resolution = 3, aperture = 3)
globe <- hex_globe(grid)
hex_globe_png(globe, "globe.png")

The image is 800 by 800 pixels; the width, height and scale
arguments of hex_globe_png() set its size.
hexglobe::gpu_adapter()
#> [1] "NVIDIA GeForce RTX 5080 (Vulkan)"
The adapter is picked once per session, preferring a discrete graphics
card. The environment variables WGPU_POWER_PREF ("low" or "high")
and WGPU_BACKEND (such as "dx12", "vulkan" or "metal"), set
before the first globe is drawn, choose another.
?render_scene, ?gpu_adapter, ?write_png and
?read_png describe each function, including the layout of a scene.Questions and bug reports go to the GitHub
issues. A bug report is
easiest to act on with a small reproducible example, for instance made
with reprex, and the output of
gpu_adapter().
“Software is like sex: it’s better when it’s free.” — Linus Torvalds
I’m a PhD student who builds R packages in my free time because I believe good tools should be free and open. I started these projects for my own work and figured others might find them useful too.
If this package saved you some time, buying me a coffee is a nice way to say thanks. It helps with my coffee addiction.
The drawing runs on wgpu, the Rust implementation of WebGPU, and the scenes and the shader come from hexify.
hexglobe is licensed under MIT.
Colling G (2026). _hexglobe: Render 'hexify' Globes on the Graphics
Card Without a Browser_. R package version 0.1.0,
<https://github.com/gcol33/hexglobe>.
BibTeX:
@Manual{colling2026hexglobe,
title = {hexglobe: Render 'hexify' Globes on the Graphics Card Without a Browser},
author = {Gilles Colling},
year = {2026},
note = {R package version 0.1.0},
url = {https://github.com/gcol33/hexglobe},
}