PDA

View Full Version : 2d Text



Aliorithm
04-10-2005, 09:14 AM
Hi Everyobody,
Yet another question!!!!!!!

How do i write 2d text on the screen??
I need a real simple approach please because most tutorials on the subject went right over my head!!!

Any help would be much appreciated!!
Thanks
ALI

147-2
04-12-2005, 03:06 PM
Well, most people do it in orthographic mode, which basically means it will not shrink into the distance. It is typically drawn after everything else. Unfortunately, the tutorials are quite to the point, they draw text as it is supposed to be done. This yeilds one advantage and one disadvantage- if you hull the tutorial and make it into a class, you can write text on the screen without really understanding the mechanics of it. If you do not understand the mechanics of this simple task, then you either haven't the patience or the wit to understand many of the things you will eventually have to do in your OpenGL programming "career."

To give you a quick run-down as to what is happening, I'll explain what the typical tutorial does. The letters of a font are typically rasterized into a set of textures that are stored in memory, either RAM or on the vid card. These textures are numbered in such a way that you can select the proper character by adding the character value to some relatively constant value. You can render the character to the screen by drawing a single quad in the location you want the letter to appear.

I hope I have helped you somewhat. I urge you to spend much more time on the tutorials, it will be good practice, since you will be dealing with harder and harder tutorials as you go along. Don't let yourself down by losing patience with a relatively simple yet contrived tutorial such as "font rendering."