Tag: Font
Adding Font support in OpenGL
by George on Apr.17, 2009, under Coding
*Update* Brandon Mantzey very kindly pointed out a glaring bug in the code accompanying this post… Never fear, I’ve tracked down the idiot responsible (me), and it’s all good now. The bug was actually two bugs – first I was confusing the width in pixels of a character’s texture and the space it takes on screen. Secondly I was working from the bottom left corner of a string, where as I should have been working from the top left. Thanks Brandon for encouraging me to fix this! The link in the paragraph below now has the updated code.
A bit of a change of pace this week as we dive into something more technical. Code that accompanies this post can be found here, and is free for you to use as you see fit.
While OpenGL provides a lot of graphical power, it’s typically at a fairly low level, giving the programmer a set of tools with which they can build higher level, more useful code. Rendering text is one example of this. Pretty much every OpenGL application needs to put text on screen at some stage. But with no built in font rendering support, we’re left to our own devices. In this blog I’ll show you one easy way to get text on screen. We’ll end up with something like the screen shot on the right.
(continue reading…)