Font: fix glyph vertex and texture coordinates
This commit is contained in:
parent
4ef71dae79
commit
33242af038
@ -87,18 +87,16 @@ namespace jes
|
|||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_ALPHA, GL_UNSIGNED_BYTE, texture);
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_ALPHA, GL_UNSIGNED_BYTE, texture);
|
||||||
delete[] texture;
|
delete[] texture;
|
||||||
|
|
||||||
float s_min = 0.5 / m_texture->get_width();
|
float s_max = width / (float)m_texture->get_width();
|
||||||
float s_max = (width - 0.5) / m_texture->get_width();
|
float t_max = height / (float)m_texture->get_height();
|
||||||
float t_min = 0.5 / m_texture->get_height();
|
|
||||||
float t_max = (height - 0.5) / m_texture->get_height();
|
|
||||||
GLfloat box[4][4] = {
|
GLfloat box[4][4] = {
|
||||||
{(GLfloat)left, (GLfloat)(top - height),
|
{(GLfloat)left, (GLfloat)(top - height),
|
||||||
s_min, t_min},
|
0.0, 0.0},
|
||||||
{(GLfloat)(left + width - 1), (GLfloat)(top - height),
|
{(GLfloat)(left + width), (GLfloat)(top - height),
|
||||||
s_max, t_min},
|
s_max, 0.0},
|
||||||
{(GLfloat)left, (GLfloat)(top - 1),
|
{(GLfloat)left, (GLfloat)top,
|
||||||
s_min, t_max},
|
0.0, t_max},
|
||||||
{(GLfloat)(left + width - 1), (GLfloat)(top - 1),
|
{(GLfloat)(left + width), (GLfloat)top,
|
||||||
s_max, t_max},
|
s_max, t_max},
|
||||||
};
|
};
|
||||||
glGenBuffers(1, &m_vbo_id);
|
glGenBuffers(1, &m_vbo_id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user