Jump to content
  • Advertisement
Sign in to follow this  
MajinMusashi

OpenGL Text rendering on different projection matrices

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

Hi! I've created a simple static library (FreeType2 wrapper) for use within SDL+OpenGL applications (it will be released soon), and it works fine for me (I mostly code 2D applications that run under orthogonal projection). The problem: people using perspective projection won't get the text rendered right! It wouldn't be hard to change the code (I know how to do it), but every WAY to do it seems to have some associated overhead. Question: How would you proceed? Some options: 1) Create two methods for printing, "renderOrtho" and "renderPerspective", and define wich one to use (using function pointers) based on a constructor argument; 2) Create one single bloated print method that do everything and works on every environment; 3) Force the programmer to change the matrices attributes himself before calling my library methods; 3) Distribute two lightweight versions of the library (an ortho version and a perspective version); Thanks a lot! PS.: I'm using Visual C++ 6.0, SDL, OpenGL and FreeType2

Share this post


Link to post
Share on other sites
Advertisement
You could add 2 functions that change the projection matrix (using glPushMatrix() and glPopMatrix()) when starting and finishing the text rendering for use with perspetive projectoin matrices. This way if they're already working with a orthogonal projection matrix, they wont need to call the functions, but if they're working with a perspective projection matrix, they can call them. If anything goes wrong, then the problem's out of your hands, 'cause you've given them everything they need to get the job done. ;)

Share this post


Link to post
Share on other sites
You're writing a library. Force the user to do that work himself. The programmer(s) will write a wrapper for the method they use most.

You could have a look at FTGL which is also an OpenGL wrapper around FreeType.

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!