Rendering textured quads by itself shouldn't be too difficult, but getting the relevant character(s) onto a texture could prove challenging. Most developers choose to render character textures onto quads. Some example techniques are: drawing letter shapes via GL_LINES, create 3D meshes of letters, or render character textures to 2D quads in a 3D environment. There are no graphical primitives for text characters, we have to get creative.
Since there is no support for text capabilities within OpenGL, it is up to us to define a system for rendering text to the screen. Based on where you live, you may also need more than 128 characters, and what if you want to express special symbols for like mathematical expressions or sheet music symbols, and what about rendering text from top to bottom? Once you think about all these complicated matters of text, it wouldn't surprise you that this probably doesn't belong in a low-level API like OpenGL. Things are getting difficult as soon as each character has a different width, height, and margin. If you don't care about rendering more than 128 different same-sized characters, then it's probably not too difficult. Contrary to what you may expect, getting a simple string to render on screen is all but easy with a low-level API like OpenGL. Text Rendering In-Practice/Text-RenderingĪt some stage of your graphics adventures you will want to draw text in OpenGL.