Jump to content
  • Advertisement
Sign in to follow this  

Text not on pixel boundaries?

This topic is 3155 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 have been trying to implement a text drawing routine based on the use of wglUseFontOutlines, from the NeHe Lesson 14. What I'm finding is that when I draw the display list for a string to the screen, the characters are not consistent, getting blocky along the edges. I'm thinking that this is being caused by the rendered characters not aligning on pixel boundaries. I'm guessing because anti-aliasing is not taking place. I can't seem to enable any sort of anti-aliasing that effects the fonts either. Is there a way to adjust for this or am I out of luck with this approach? I was using bitmap fonts, but had a need to be able to rotate text, so started using the outline fonts. I have been hesitant to implement a texture based font (NeHe Lesson 17) since it seems that would result in a fixed-width fonts (unless I'm missing something) Or, am I going to have to make the jump and implement my fonts using the FreeType libraries? :(

Share this post

Link to post
Share on other sites
I had a thought after I made my post, that perhaps I could change the starting location by taking into account the openGL coordinates and the screen width in pixels.

For instance, by field of view in Ortho Mode is 26 x 19.5 while the pixels are 800x600 (resulting in 0.0325 units per pixel)

Figured I could do something like (C# Tao Framework):

double xAdj = ((int)(x / 0.0325))*0.0325);
double yAdj = ((int)(y / 0.0325))*0.0325);

Gl.glTranslated( xAdj, yAdj, zDepth);

Which worked fine for the first character - rendered cleanly - however every subsequent character was off still, due to the use of a proportional font.

I guess my only option would be to process the string one character at a time,
however since my current sequence of operations is:

glTranslate() // position the font
glRotate() // rotate to angle
glScale() // scale font to size
glCallLists() // display font

I don't think this would be very easy to accomplish, due to the rotate and scale operations...

Somehow I think I may be greatly over complicating things... ;)

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • 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!