1
\$\begingroup\$

I have tried to implement text rendering in OpenGL from several tutorials and guides but I am unable to implement any of them successfully.

The latest one I have attempted is [Here] but it seems to be incompatible with GL 4.5. My end goal is to implement the ability to load TTF files into OpenGL and render them. If someone could give me a hand with a sample code snippet of how to implement this myself, or even to reconfigure the free type library, that would be appreciated!

\$\endgroup\$
1
\$\begingroup\$

There are three approaches to rendering fonts in OpenGL: bitmap, outline (polygonal), and texture mapped. Each method has its own advantages and disadvantages.

Source: https://www.opengl.org/archives/resources/features/fontsurvey/

Choosing a method depends on how you want your text to be displayed. If you need your text to be easily scaled and rotated, and you care about performance, use bitmaps. If you want your text to be antialiased, without the hassle, use outlines. Basically, you're just drawing polygons with many points, so the resolution is fully customizable. You can also integrate texture mapping with this method.

If you would rather use a library, check out FreeType.

\$\endgroup\$
  • \$\begingroup\$ Did this answer your question? \$\endgroup\$ – Oliver Yasuna Aug 27 '17 at 23:43
  • \$\begingroup\$ Checkout this repo, converts any text into 3d object given ttf files. github.com/codetiger/Font23D \$\endgroup\$ – codetiger Jun 9 '18 at 6:40
0
\$\begingroup\$

I'm afraid that using the FreeType is the only way to do what you want. Even DirectX needs font as a texture. Why do you want to 'reconfigure' the library, and what does it mean to you?

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.