3

I load an bitmapfont (as png image) in my openGL Application to render characters from there at a fixed size. That's working. But: If I want to scale some glyphs at a smaller size it doesnt look great. Is there a way - without using pregenerated mipmaps (I have a big bunch of several characters and need stepless sizes) to scale this more beautiful? Some way of interpolation or something?

At the moment I use something like this (C/C++ on Mac OS X):

glPopMatrix();
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBindTexture(GL_TEXTURE_2D, texture->getID());
glScalef(0.7f, 0.7f, 0); //scale here a size

{draw vertexes & set texcoords}

glDisable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glPushMatrix();

Any suggestion?

Constantin
  • 8,721
  • 13
  • 75
  • 126
  • Item 17.020 in this faq: http://www.opengl.org/resources/faq/technical/fonts.htm – Hans Passant Jan 09 '11 at 14:43
  • Thats about TrueType fonts - I'm speaking about Bitmap fonts. Its not my intention to use TrueType fonts for serveral reasons (i.e. font licensing). – Constantin Jan 09 '11 at 14:56

1 Answers1

5

Did you try using Linear filtering on your textures?:

glTexParameteri(GL_TEXTURE_2D, GL_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_MAG_FILTER, GL_LINEAR);

This after binding textures.

Dr. Snoopy
  • 55,122
  • 7
  • 121
  • 140
  • 1
    BTW - Game Programming Gems, part 6 has an article on how to achieve good-quality scaling of signs (so also glyphs). An easy way to get much better results than with regular linear interpolation which will result in blurred borders. – Kos Jan 09 '11 at 21:14