TTF_Font to GL Display List Kerning issue
[Edit] Forgot to mention that although the font looks like it has an outline, that's just part of the font. The actual true-type font looks like that, haha. Also, I can end up with it looking like this http://i.imgur.com/x6jl5.jpg, which is better, if I remove the first glTranslate to "minx", but the spacing still looks wrong. [/Edit]
I'm working on font code in my SDL_GL application, using SDL_TTF. The code to generate and call the display list is working, but the spacing looks off: http://i.imgur.com/7Fan7.jpg
The relevant section of code is this section:
Code:
glNewList(list+ch, GL_COMPILE);
glBindTexture(GL_TEXTURE_2D, tex[ch]);
int minx, maxx, miny, maxy, advance;
TTF_GlyphMetrics(Font, ch, &minx, &maxx, &miny, &maxy, &advance);
glPushMatrix();
glTranslated(minx, miny, 0);
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex2i(0, 0);
glTexCoord2f(1, 0); glVertex2i(sText->w, 0);
glTexCoord2f(1, 1); glVertex2i(sText->w, sText->h);
glTexCoord2f(0, 1); glVertex2i(0, sText->h);
glEnd();
glPopMatrix();
glTranslated(advance, 0, 0);
glBindTexture(GL_TEXTURE_2D, 0);
glEndList();
Is the advance part of glyph metrics in SDL_TTF just not good enough? I tried switching "glTranslated" to "glTranslatef", but TTF_GlyphMetrics returns ints and not floats so it doesn't change anything.