Backout changeset e90d89c7b9712297c14ba73eda37ec28f25101f9

This commit is contained in:
Bill Meltsner
2012-01-08 20:14:27 -06:00
parent 5fa0a4cfa3
commit 4c5d11d582
+6 -7
View File
@@ -57,8 +57,7 @@ namespace opengl
void Font::createTexture() void Font::createTexture()
{ {
texture_x = texture_y = 1; texture_x = texture_y = rowHeight = 0;
rowHeight = 0;
GLuint t; GLuint t;
glGenTextures(1, &t); glGenTextures(1, &t);
textures.push_back(t); textures.push_back(t);
@@ -93,12 +92,12 @@ namespace opengl
} }
love::font::GlyphData *gd = rasterizer->getGlyphData(glyph); love::font::GlyphData *gd = rasterizer->getGlyphData(glyph);
g->spacing = gd->getAdvance(); g->spacing = gd->getAdvance();
int w = gd->getWidth()+1; int w = gd->getWidth();
int h = gd->getHeight()+1; int h = gd->getHeight();
if (texture_x + w > TEXTURE_WIDTH) if (texture_x + w > TEXTURE_WIDTH)
{ // out of space - new row! { // out of space - new row!
texture_x = 1; texture_x = 0;
texture_y += rowHeight+1; texture_y += rowHeight;
rowHeight = 0; rowHeight = 0;
} }
if (texture_y + h > TEXTURE_HEIGHT) if (texture_y + h > TEXTURE_HEIGHT)
@@ -107,7 +106,7 @@ namespace opengl
} }
GLuint t = textures.back(); GLuint t = textures.back();
glBindTexture(GL_TEXTURE_2D, t); glBindTexture(GL_TEXTURE_2D, t);
glTexSubImage2D(GL_TEXTURE_2D, 0, texture_x, texture_y, w-1, h-1, (type == FONT_TRUETYPE ? GL_LUMINANCE_ALPHA : GL_RGBA), GL_UNSIGNED_BYTE, gd->getData()); glTexSubImage2D(GL_TEXTURE_2D, 0, texture_x, texture_y, w, h, (type == FONT_TRUETYPE ? GL_LUMINANCE_ALPHA : GL_RGBA), GL_UNSIGNED_BYTE, gd->getData());
Quad::Viewport v; Quad::Viewport v;
v.x = (float) texture_x; v.x = (float) texture_x;