I’m using Linux and GLUT. I have a square as follows:
glVertex3f(-1.0, +1.0, 0.0); // top left glVertex3f(-1.0, -1.0, 0.0); // bottom left glVertex3f(+1.0, -1.0, 0.0); // bottom right glVertex3f(+1.0, +1.0, 0.0); // top right
I guess I can’t use glutBitmapCharacter, since this is only ideal for 2D ortho.
Simple enough, I’d like to render ‘Hello world!’ anywhere on said square. Should I create a texture and then apply it to the vertices using glTexCoord2f?
The simplest way is to load a font map from a image, such as those generated by the bitmap font builder (I know it’s windows but I can’t find one for linux), eg:
The example is a 256×256 gif, though you may what to convert it to a png/tga/bmp. It’s full ASCII mapped gird, 16×16 characters. Load the texture and use glTexCoord2f to line it up on your quad, and you should be good to go.
Here’s an example using a bitmap of the above: