Domanda

I have a simple question. I'm using FTGL library for drawing my PixmapFont in my game application. My question is - is it possible to use glScalef() to scale raster font, or not? From what I understand, if I have to use glRasterPos() instead of glTranslatef() it also probably considers glScalef() function? But if so, isn't there any way of scaling this font?

This is what I need scaling for:

I can change it's size, by simply putting this:

font->FaceSize(12);

But it gives me blurry effect for such small font. From what I've read somewhere, it is good to render font with larger size - e.g. 72 - and then to scale it down, because it gives better results.

È stato utile?

Soluzione 2

Instead of pixmap (raster) fonts, you need to use texture fonts. This draws the font as a texture mapped to triangle primitives, which is far more flexible and widely supported than drawing directly to the framebuffer. See also the FTTextureFont documentation.

Because it's just rendering OpenGL primitives, this approach considers all the usual transformations you set with glTranslatef, glScalef and so on. For the cleanest result, use glOrtho to set a pixel-perfect projection matrix.

Altri suggerimenti

The OpenGL bitmap drawing functions (glBitmap), are not affected by the transformation pipeline, as they go directly to the framebuffer. However the bitmap drawing functions always used to be slow, poorly supported and have been removed from later versions of OpenGL entirely.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top