Sign in to follow this  

Text not on pixel boundaries?

This topic is 2852 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

This topic is 2852 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this