OpenGL Filtering/Antialising/Mipmaps

Started by
7 comments, last by Merlino 17 years, 5 months ago
I'm creating an App for displaying text through openGL textures. I decided to create a .tga image for every letter and I made them rather big (213x213 pix) so that I could render large words on screen. The problem comes when I render small words, say 0.1 of the original image size, the letters appear rather aliased. Aliased Textures Yes, it is not THAT aliased, but I'm sure there is a way to render it better, I just don't know how to do it. I read about Mipmaps but they are only useful when the scene is not static. Anyway, I used the gluBuild2DMipmaps function to create the textures so this should not be the problem. As for the GL_TEXTURE_MAG_FILTER, I used GL_LINEAR and GL_LINEAR_MIPMAP_LINEAR for the GL_TEXTURE_MIN_FILTER. So how can I anti-alias these textures? Thanks in advance, Merlino
Advertisement
Quote:I read about Mipmaps but they are only useful when the scene is not static.

not necessary

Quote: Anyway, I used the gluBuild2DMipmaps function to create the textures so this should not be the problem.

glubuildmipmaps does a simple box filter (which is about as bad as u can get)
youre best off generating the mipmaps yourself + loading that result into a opengl texture
the nvidia photoshop dds plugin has various methods of generating mipmaps
I think you should render different textures for the different sizes of letters and not to scale the textures. Rendering should be done with a truetype library and antialiasing turned on. It will result in much better antialiasing, because it uses another technique than just scaling and interpolating. Look at nehe for a simple tutorial on truetype rendering.
I've looked a bit on google for the truetype font rendering, and I am not sure that this is what I should use because I want to put some glows to the words I made later on, using a per letter glow, and it would be a lot easyer to do it having the letter drawn as a texture...

Anyway, you said I should use Antialiasing: I looked for some tutos about it on google but I did not find how to turn it on. So how do I turn on antialiasing?

As for mipmaps, you say I should do this right?:
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 212,212,0,GL_RGB, GL_UNSIGNED_BYTE, texObject0);glTexImage2D(GL_TEXTURE_2D, 1, GL_RGB, 106,106,0,GL_RGB, GL_UNSIGNED_BYTE, texObject1);glTexImage2D(GL_TEXTURE_2D, 2, GL_RGB, 52,52,0,GL_RGB, GL_UNSIGNED_BYTE, texObject2);glTexImage2D(GL_TEXTURE_2D, 3, GL_RGB, 26,26,0,GL_RGB, GL_UNSIGNED_BYTE, texObject3);glTexImage2D(GL_TEXTURE_2D, 4, GL_RGB, 12,12,0,GL_RGB, GL_UNSIGNED_BYTE, texObject4);
... and so on. For the mipmaps do I have to tell the App which one to use based on the font size or does it do it by himself?

And are the GL_TEXTURE_MIN/MAG_FILTER useful as I set them ?

Thanks
i think using texture for each letter is litle bit overkill. it needs changing texture for each letter, which is very expensive. Use one texture for entire font. I can recoment this : http://www.angelcode.com/products/bmfont/
Quote:Original post by Falhar
i think using texture for each letter is litle bit overkill.


Are you sure?
I tried to check the fps of the scene and, even with a line full of letters, they don't go under 999. Ok, the scene is rather simple and my computer is quite powerful (AMDX2 3800+,x800GTO2), but 999 fps is a lot (I'm using fraps for benchmarking and I think 999 is the max it can record).

But this is not the point, I was not especially talking about fonts being aliased but just textures in general.

Anyway thanks, I'll give a try to http://www.angelcode.com/products/bmfont/



Try filling the screen with letters. Your method is going to be painfully slow for any larger text amount, and for any older computers. You really should pack the entire font into one big texture whenever possible, especially when rendering such small text.

Wow, faster hardware really makes people lazy...
Alright, alright. So this means I won't be able to use a per letter glow right?

Unless I combine all the glows of the letters of the text in one single texture while program is running. Do you think this could be a good solution?
So does anybody know how to turn the antialiasing on?

This topic is closed to new replies.

Advertisement