From 2e51d92a92d5c95139c064182a9a6e2e8b2ee590 Mon Sep 17 00:00:00 2001 From: Joe Wilm Date: Thu, 2 Jun 2016 22:14:55 -0700 Subject: Use texture atlas for glyphs This dramatically reduces the number of BindTexture calls needed when rendering the grid. Draw times for a moderately full terminal of the default size are ~1ms with this patch. --- src/main.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 9e9a6e86..b6a36330 100644 --- a/src/main.rs +++ b/src/main.rs @@ -104,9 +104,11 @@ fn main() { let mut grid = Grid::new(num_rows as usize, num_cols as usize); + let mut renderer = QuadRenderer::new(width, height); + let mut glyph_cache = HashMap::new(); for c in INIT_LIST.chars() { - let glyph = Glyph::new(&rasterizer.get_glyph(&desc, font_size, c)); + let glyph = renderer.load_glyph(&rasterizer.get_glyph(&desc, font_size, c)); glyph_cache.insert(c, glyph); } @@ -124,7 +126,6 @@ fn main() { } }); - let mut renderer = QuadRenderer::new(width, height); let mut terminal = Term::new(tty, grid); let mut meter = Meter::new(); -- cgit