diff options
author | Joe Wilm <joe@jwilm.com> | 2016-06-06 13:20:35 -0700 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2016-06-06 13:20:35 -0700 |
commit | ed7aa96907e8c5e51facb45f9b590ce25b4f3dd5 (patch) | |
tree | dfd2185e57f9ff792d25ae7ca81d56b69e96096d /src/main.rs | |
parent | 1f3f9add49d9b6fae8f57bb907b278eb06b513c9 (diff) |
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.
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 14 |
1 files changed, 9 insertions, 5 deletions
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(); } |