From 0170d1623a82ee3448a037f8fa648f5bac14a96e Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 26 Oct 2019 17:39:46 -0700 Subject: [PATCH] clarify vertex indices --- src/frontend/software/quad.rs | 8 ++++---- src/frontend/software/renderstate.rs | 15 ++++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/frontend/software/quad.rs b/src/frontend/software/quad.rs index b69145a9b..2adafc5f4 100644 --- a/src/frontend/software/quad.rs +++ b/src/frontend/software/quad.rs @@ -4,10 +4,10 @@ use ::window::*; /// Each cell is composed of two triangles built from 4 vertices. /// The buffer is organized row by row. pub const VERTICES_PER_CELL: usize = 4; -const V_TOP_LEFT: usize = 0; -const V_TOP_RIGHT: usize = 1; -const V_BOT_LEFT: usize = 2; -const V_BOT_RIGHT: usize = 3; +pub const V_TOP_LEFT: usize = 0; +pub const V_TOP_RIGHT: usize = 1; +pub const V_BOT_LEFT: usize = 2; +pub const V_BOT_RIGHT: usize = 3; #[derive(Copy, Clone, Default)] pub struct Vertex { diff --git a/src/frontend/software/renderstate.rs b/src/frontend/software/renderstate.rs index dd89552d9..d676fdd5e 100644 --- a/src/frontend/software/renderstate.rs +++ b/src/frontend/software/renderstate.rs @@ -11,7 +11,7 @@ use failure::Fallible; use std::cell::RefCell; use std::rc::Rc; -use super::quad::Vertex; +use super::quad::*; pub struct SoftwareRenderState { pub glyph_cache: RefCell>, @@ -168,12 +168,13 @@ impl OpenGLRenderState { }); // Emit two triangles to form the glyph quad - indices.push(idx); - indices.push(idx + 1); - indices.push(idx + 2); - indices.push(idx + 1); - indices.push(idx + 2); - indices.push(idx + 3); + indices.push(idx + V_TOP_LEFT as u32); + indices.push(idx + V_TOP_RIGHT as u32); + indices.push(idx + V_BOT_LEFT as u32); + + indices.push(idx + V_TOP_RIGHT as u32); + indices.push(idx + V_BOT_LEFT as u32); + indices.push(idx + V_BOT_RIGHT as u32); } }