#texture-atlas #2d #dynamic

no-std etagere

Dynamic 2D texture atlas allocation using the shelf packing algorithm

17 releases

0.3.0 Mar 18, 2026
0.2.15 Jan 21, 2025
0.2.13 Jun 17, 2024
0.2.10 Nov 17, 2023
0.2.1 Nov 26, 2020

#16 in #texture-atlas

Download history 11527/week @ 2026-03-03 77922/week @ 2026-03-10 58169/week @ 2026-03-17 61936/week @ 2026-03-24 65892/week @ 2026-03-31 71649/week @ 2026-04-07 84009/week @ 2026-04-14 93237/week @ 2026-04-21 86496/week @ 2026-04-28 89628/week @ 2026-05-05 97496/week @ 2026-05-12 103605/week @ 2026-05-19 108737/week @ 2026-05-26 91927/week @ 2026-06-02

414,753 downloads per month
Used in 484 crates (60 directly)

MIT/Apache

92KB
2K SLoC

Étagère

crates.io documentation

A dynamic texture atlas allocator using the shelf packing algorithm.

Motivation

The ability to dynamically batch textures together is important for some graphics rendering scenarios (for example WebRender).

The shelf packing algorithm works very well when there is a high number of items with similar sizes, for example for dynamic glyph atlases.

See also guillotière, another dynamic atlas allocator based on a different algorithm, with different packing and performance characteristics.

Example

use etagere::*;

let mut atlas = AtlasAllocator::new(size2(1000, 1000));

let a = atlas.allocate(size2(100, 100)).unwrap();
let b = atlas.allocate(size2(900, 200)).unwrap();

atlas.deallocate(a.id);

let c = atlas.allocate(size2(300, 200)).unwrap();

assert_eq!(c.rectangle, atlas.get(c.id));

atlas.deallocate(c.id);
atlas.deallocate(b.id);

License

Licensed under either of

at your option.

Dependencies

~72–270KB