Skip to main content
GameDev.net gamedev.net
🔒 Locked

a font generator problem

Started by Yozh_Programmer Apr 24, 2004 at 7:54 PM 2 replies 200+ views
Original Post
Yozh_Programmer
Yozh_Programmer
A wrote a font generator. Any font you want you can generate in any size. Original font is sharp enough and looks beautiful. But my font class supports zooming of font. So you can change the size of font on the screen. But the problem is that when you change zoom aspect, the texture of the font becomes smaller, and cause to font to be sharpless. How to make texture to stay sharp even if it becomes smaller. I make zooming through glScale function. And GL_TEXTURE_MAG(MIN)_FILTER to GL_LINEAR. Thanx for your attention.
Ostsol
Ostsol
There really isn''t any simple way. You could have multiple textures of various sizes, each representing a certain font size. . .
-Ostsol
urayami
urayami
Hi. I''m not sure if you''re having any sharpness problems when you move it close (I''m guessing no), but as far as when you zoom out (font gets "smaller"), I think using mipmapping would help for that since it generates textures of various sizes. Try this:

glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) ;
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST) ;

There are various levels of mipmapping though. Here are four I am away of:

#define GL_NEAREST_MIPMAP_NEAREST 0x2700
#define GL_LINEAR_MIPMAP_NEAREST 0x2701
#define GL_NEAREST_MIPMAP_LINEAR 0x2702
#define GL_LINEAR_MIPMAP_LINEAR 0x2703

You might want to play around with these. Good luck!

~Urayami
~Urayami

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.