Jump to content

  • Log In with Google      Sign In   
  • Create Account


Font rendering with Freetype - Quality problems


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Plerion   Members   -  Reputation: 354

Like
0Likes
Like

Posted 19 May 2013 - 01:59 AM

Hello

To render text im using freetype and a i create display lists that will be rendered. Now my problem is that on NVIDIA cards my text sometimes looks very bad (on ATI this problem does not occur). I have made an image showing the problem:
5198854aa3731_FontRender.jpg

The problem occurs if i render my text at a position that is not an integral number but of the form XXX.5f. If i change my code for example from
spriteFont->render(L"Loading...", (width - textWidth) * 0.5f, (height - textHeight) * 0.5f);

to

spriteFont->render(L"Loading...", (int32)((width - textWidth) * 0.5f), (int32)((height - textHeight) * 0.5f));

its fine no matter what the actual values are.

Is that a known effect?

Greetings
Plerion

Sponsor:

#2 web383   Members   -  Reputation: 737

Like
1Likes
Like

Posted 19 May 2013 - 12:00 PM

Yes, this makes sense to me.  When dealing with any pixel-perfect rendering, you should always represent your positions and sizes as integers.  When you specify a 0.5f, the GPU will ultimately have to choose which pixel it gets mapped to (this is actually done based on your projection matrix).  I'm not sure why it's different on NVIDIA vs ATI, but it's probably due to floating point math differences.

 

For pixel perfect rendering I would use an orthographic projection that maps directly to your screen resolution.  Also make sure the viewport (glViewport() if you're using OpenGL) is also set to your screen resolution.  Don't rely on the default viewport that is set for you when you bind the OpenGL context.

 

I've recently implemented font rendering using freetype and have had results almost exactly to what you have shown in your image.



#3 Plerion   Members   -  Reputation: 354

Like
0Likes
Like

Posted 19 May 2013 - 01:13 PM

Hey

 

Yes, im using an orthogonal matrix and a viewport according to the window size. About the difference on the cards ive realized that my ATI card runs on double precision while the NVIDIA is not.

 

So ill just stick to the integral values, now that i know it its ok :D

 

Greetings

Plerion






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS