To render fonts on OpenGL you have to create a texture containing all the glyphs required (texture atlas) and, at least, the position information of every glyph in the texture (position-size coordinates). When you draw text, actually, you draw multiple quads with the required texture coordinates using the font texture atlas. It requires some code, not only to generate the texture atlas from the TTF font but also to manage and render every required quad for a given text string.
As a simpler solution, you can consider using raylib (www.raylib.com
) that already manages all that for you... or just check raylib source code (https://github.com/raysan5/raylib/blob/ ... src/text.c
). If you check the examples section in raylib webpage, there are multiple text related code examples: http://www.raylib.com/examples.htm
Hope it works for you!