Font Rendering Practices

I did this a while ago but I lost the code in an Arch to Arch transition. Something to do with my video drivers.

In order to render text on the screen with LWJGL I’ve seen that you can use a quad/triangles and just render each letter, called from a texture atlas with all the characters, to the quad. However I don’t know if this is good practice or if there’s even another way.
There’s the way slick-util does it, and I don’t have experience with that, but it seems pretty easy. I think this may use the solution I talked about above.

Is there some “generally accepted” way to render text to the screen that is suggested?

Thanks.

Edit: I just found this video that actually defines each vertex for the letters. This is usable, however it doesn’t allow for any actual fonts. https://www.youtube.com/watch?v=JFQhhwVqqs8
Interesting anyway.

If you’re looking for the one you explained, here’s a messy TextRenderer: TextRenderer.java
The font image:

https://random-rpg.googlecode.com/svn/src/res/font.png

Link to image: font.png
I know the image is not easy to see, but trust me it’s there :stuck_out_tongue:

I don’t think this is the best way to render text…
But it worked in my case :slight_smile:

I saw the link to the file a bit earlier, that’s how I knew what it was doing.
Thanks though :slight_smile:

Any other suggestions would be appreciated.

There is no other way. You need to have your letters as textures in some form.You then need to draw quads for each letter to actually render each letter. If you’re experienced with OpenGL, you can “simplify” the code a bit by using a 2D texture array where each layer is a single letter, and use a geometry shader to be able to render the fonts as points which gets expanded to quads by the GPU.

That was the kind of thing I expected. Ah well, so much for the magical easy route of happiness.
Thanks for clarifying.