Re: [Plib-devel] noisy font
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2005-08-06 03:02:15
|
Fay John F Contr AAC/WMG wrote: > Bram, > > The first thing I would note is that the "hello_world" font is > 30 points while the "fnt_test" fonts are 25 points. That seems to make > a big difference; when I changed the "hello_world" font size to 25 > points it looked a lot like the other. > > This raises the next question: why does changing the point size > make the rendering that much noisier? Well, fonts are rendered using textures. If you have a texture that's (say) 25 texels high - and you stretch it out to cover (say) 30 pixels - what happens? If the texture map's magnification filter is set to interpolated sampling (GL_LINEAR) then every display pixel will be linearly interpolated between the two texels closest to the ideal position. This generally results in a certain amount of blurring in the map. On the other hand, if the texture map's magnification filter is set up for point sampling (GL_NEAREST) then you'll find that every fifth texel is duplicated to fill the gaps you'd get from stretching the texture. This produces the 'noisier' look that you are seeing. So - take your pick! Noisy or blurry? The only way to get reasonably crisp fonts from texture is to render using GL_NEAREST and to render the font at the exact size of the map. Going to exactly twice the size also works reasonably well providing your screen is high enough resolution that you can stand the blockiness you get from doubling the size of the texels in the font. On higher resolution displays, GL_LINEAR looks better to my eyes. It's a little blurrier - but it stays looking pretty much the same over a wider range of sizes. ---------------------------- Steve Baker ------------------------- HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://www.sjbaker.org Projects : http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net -----BEGIN GEEK CODE BLOCK----- GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M- V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++ -----END GEEK CODE BLOCK----- |