TAGS :Viewed: 1 - Published at: a few seconds ago

[ LWJGL 3 - Rendering Text ]

I'm trying to render text in LWJGL 3 using non-deprecated OpenGL. I cannot use Slick-Util, which relies on older versions of LWJGL and deprecated OpenGL.

I would use FreeType if I was writing in standard C++ OpenGL, but I cannot. So how would I begin to create a class that can handle text rendering, with support for:

  • Different fonts / font sizes / bold, italics, etc
  • Font coloring
  • Font transforms

Does anyone have any good resources on this subject, preferably in Java and LWJGL?

Answer 1

LWJGL3 has a built in binding to STB which can load TTF font files, there are examples in the LWJGL3 repo which show you how to render text using it.

Further details and examples for the same can be found here.