From ed7aa96907e8c5e51facb45f9b590ce25b4f3dd5 Mon Sep 17 00:00:00 2001 From: Joe Wilm Date: Mon, 6 Jun 2016 13:20:35 -0700 Subject: Refactor Instanced Drawing to use Vertex Arrays Per-instanced data was previously stored in uniforms. This required several OpenGL calls to upload all of the data, and it was more complex to prepare (several vecs vs one). Additionally, drawing APIs are now accessible through a `RenderApi` (obtained through `QuadRenderer::with_api`) which enables some RAII patterns. Specifically, checks for batch flushing are handled in Drop. --- src/main.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 79c368df..e9817331 100644 --- a/src/main.rs +++ b/src/main.rs @@ -194,17 +194,21 @@ fn main() { { let _sampler = meter.sampler(); - // Draw the grid - renderer.render_grid(terminal.grid(), &glyph_cache, &props); + renderer.with_api(&props, |mut api| { + // Draw the grid + api.render_grid(terminal.grid(), &glyph_cache); - // Also draw the cursor - renderer.render_cursor(terminal.cursor(), &glyph_cache, &props); + // Also draw the cursor + api.render_cursor(terminal.cursor(), &glyph_cache); + }) } // Draw render timer let timing = format!("{:.3} usec", meter.average()); let color = Rgb { r: 0xd5, g: 0x4e, b: 0x53 }; - renderer.render_string(&timing[..], &glyph_cache, &props, &color); + renderer.with_api(&props, |mut api| { + api.render_string(&timing[..], &glyph_cache, &color); + }); window.swap_buffers().unwrap(); } -- cgit