I am generating a texture that contains mainly text. The resultant display looks fuzzy (from a 256 x 512 texture) … so I wondered how it would look if I used 512 x 1024 texture). I was disappointed to discover that the result looked worse … the text looked sharper but very ‘blocky’ and much less readable (the actual texture bitmaps look fine).
At a screen resolution of 1600x1200 the result was dramatically better but I need to support lower screen resolutions and the result is poor.
I’m using the following to bind the texture :
glTexSubImage2D(GL_TEXTURE_2D, 0, X, Y, Bitmap.Width, Bitmap.Height, GL_RGB, GL_UNSIGNED_BYTE, BitmapData);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
Is there anything that I can do to improve the display and maybe someone could explain why the display looks worse when using a higher resolution texture ?
Oops … I did a copy and paste on another piece of code that uses MipMapping … the code in question should have used :
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
you should enable mipmaping/trilinear filtering, to avoid texture aliasing when MIN_FILTER kicks in, but of course text may appear blurrer at some times.
>> why the display looks worse when using a higher resolution texture ?
Most certainly because of mipmaping, when you fall right before the higher resolution mip ? You can try to slowly zoom int/out and see if text looks better at some distances.
A warning though, sometimes display drivers ‘cheat’ and blur textures or use a less advaced filtering (bilinear or even point sampling insteand of trilinear, etc), you may set this with “quality” sliders in display control panel.
To me the best settings should be :
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // no trilinear possible with magnification
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); // trilinear when screen resolution lower than tex resolution
Do you have screen shots to describe better your “sharper but very ‘blocky’” text ?
I guess another solution is to make yourself the different resolutions of the image (with rewritting your text for each resolution).
Many thanks … yes, I did find that it was related to the zoom and I have therefore adopted the suggestion to produce the texture resolution in proportion to zoom / screen resolution and it now works very well.