PDA

View Full Version : texture mapped fonts



xargon
12-14-2005, 06:53 AM
Hi everyone,

I am using texture mapped fonts to render text in OpenGl. So, I have a
texture for a font in size 12. Is it possible to scale it for sizes
greater or less than 12. What commands could be used to scale a
texture?

Also, is there a property that I can specify during creation of the
texture so that the fonts are still crisp after scaling...

Also, could someone recommend a good tool for generating high quality
bmps from true type fonts? I can pay for the tool, so it does not have
to be free.

I would really appreciate the help and advice.

Thanks and cheers,
xargon

xargon
12-14-2005, 07:22 AM
Well, found out the scaling...

glScalef(factor, factor, factor)...

I generated a bitmap from the Courier New font at size 12. I sclaed it using the glScaleF function, like:

glScalef(4.0, 4.0, 0.0);

However, the font loses its sharpness. Is there a way to make sure it retains the sharpness?

Cheers,
xargy

songho
12-14-2005, 08:05 AM
The easiest fix for blury texture would be set texture filtering with GL_NEAREST in glTexParameter*(). But It looks very blocky.

How about creating multiple bitmaps in various sizes, for example, small, medium, large, etc...
Here is an example: fonts (http://www.songho.ca/opengl/files/fonts.jpg)

xargon
12-14-2005, 09:54 AM
Hi,

Thanks for the reply. I might just try some intermediate sizes and interpolate between them.

xargon
12-14-2005, 10:38 AM
Hello everyone,

One more question about the fonts and I would be really grateful if someone could address this one.

I am playing around with Nehe tutorials on OpenGL, lesson 14 to be particular. The lesson uses wglUseFontOutlines function to render a 3D font. The program uses CreateFont API to create the font, selects it into the device context and passes it on to wglUseFontOutlines function.

Now, I tried chaging the height parameter of the CreateFont API... However, the font being rendered is always the same size! Does anyone know what I am missing here (besides my brain ;) )??!

Cheers,
xargon