From 33242af038f8ada4be6a0a8675badf7e5ade7508 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 24 Jun 2014 09:29:28 -0400 Subject: [PATCH] Font: fix glyph vertex and texture coordinates --- src/gui/Font.cc | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/gui/Font.cc b/src/gui/Font.cc index b3a1e16..01b81eb 100644 --- a/src/gui/Font.cc +++ b/src/gui/Font.cc @@ -87,18 +87,16 @@ namespace jes glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_ALPHA, GL_UNSIGNED_BYTE, texture); delete[] texture; - float s_min = 0.5 / m_texture->get_width(); - float s_max = (width - 0.5) / m_texture->get_width(); - float t_min = 0.5 / m_texture->get_height(); - float t_max = (height - 0.5) / m_texture->get_height(); + float s_max = width / (float)m_texture->get_width(); + float t_max = height / (float)m_texture->get_height(); GLfloat box[4][4] = { {(GLfloat)left, (GLfloat)(top - height), - s_min, t_min}, - {(GLfloat)(left + width - 1), (GLfloat)(top - height), - s_max, t_min}, - {(GLfloat)left, (GLfloat)(top - 1), - s_min, t_max}, - {(GLfloat)(left + width - 1), (GLfloat)(top - 1), + 0.0, 0.0}, + {(GLfloat)(left + width), (GLfloat)(top - height), + s_max, 0.0}, + {(GLfloat)left, (GLfloat)top, + 0.0, t_max}, + {(GLfloat)(left + width), (GLfloat)top, s_max, t_max}, }; glGenBuffers(1, &m_vbo_id);