Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Cutting the font for lesson 17 in half

This topic is 5692 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve been trying for a few days to cut down the file size for the bitmap font in lesson 17. By cutting down i mean loosing the last 128 "characters" of the file. I cut the bitmap no problem but when i run the font code and display text on the screen it''s not aligned anymore. I thought maybe it was the texture loading routine that i had or possibly when i generated the font. I''ve modified both of those and hasn''t changed a thing. Any help would be great. Thanks

Share this post

Link to post
Share on other sites
Not sure what you are talking about. I think if you are talking about only having certian charactors availabl, or resizing them, then you need to modify the code that cut the texture up and stores it into the display list.

Or if you are trying to make the texture file size smaller, then use a different bmp format, lose the color info. Or use a different format like jpeg or tga (think tga is bigger..?)

Does that help? If not try clearifying.

Dustin Davis
Owner / CEO
Programmers Unlimited

[edited by - Titan2782 on March 23, 2003 11:43:51 AM]

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
No matter how many pixels are in a texture, the texture coordinates always go from s=0 on the left to s=1 on the right, and t=0 on the bottom to t=1 on the top. (Note that some texture loaders or file formats flip the image upside down, so that you may have t=0 on the top).

If you cut out half the data vertically, you''ll stretch everything rendered half the size in height. The solution is to multiply all your "t" texture coordinates by 2.

Share this post

Link to post
Share on other sites
pfff aww.. that worked great!
i always forget about that 0 to 1.

if anyone is interested in doing the same thing. modify the lines in lesson 17 so they look like this:

cy = (float(loop / FontHeight) / FontHeight) * 2; // Y Position Of Current Character
glTexCoord2f(cx, 1-cy-0.125); // Texture Coord (Bottom Left)
glTexCoord2f(cx+ 0.0625f, 1-cy-0.125); // Texture Coord (Bottom Right)

basically your gonna drop the last 128 characters from the bitmap font, don't forget to modify the bitmap to make it 256x128 (don't resize, actually cut it).

[edited by - PsychoPaul on March 23, 2003 1:41:24 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!