PDA

View Full Version : TEXT - HOW?!



Keifo
11-13-2001, 09:23 AM
Right, this is doing my head in. How can I get 2D text on the screen? I don't want posts with links to some poxy tutorial that gives some total in depth explanation with 400 lines of code. Just an explanation as one would if they wanted to know how to use glVertex2f().

Many thanks in advance if there is someone helpful enough.

jabe
11-13-2001, 12:28 PM
there are many possibilities to do this. i cannot say, do it with the following two lines of code. but i will give you some keywords.

1. bitmapfonts. build a bitmpafont (array of ints or bytes or shorts or whatever) and render it with glBitmap(...). it is described in the red book (available as pdf) very well.

2. texturemapped fonts. generate a texturemap with needed letters and render each letter as a quad with texturecoords corresponding the box of the letter in the texturemap.

both approaches are practical and useful. whether one is better or the other depends on what you want to do. 1. an only draw monocolor fonts (AFAIK). 2. needs texturememory but can draw multicolor fonts.

nevertheless you can look into nehe's tutorials. ok, you have to read maybe 400 lines of code, but you should be able to decide what is important for you and what not. goot luck.

regards,
jan

Lev
11-13-2001, 12:53 PM
Also take a look at the appropriate section in the FAQ.

-Lev

Shag
11-13-2001, 03:21 PM
Alternatively .... do what the rest of us do - look at the F##cking tutorials!

It's the only way to learn. Admittedly, it's not the most interesting way of learning ... but if you want to learn (and you know how to program) then you can work the rest out for yourself.

Keifo
11-13-2001, 11:47 PM
Thanks people - got a project to do for uni and not having much time to get it done doesn't leave you much room to read through reams of tuts - I'll try the bitmap font thing. I have the red book, just find it a bit tricky to get into. I wish I had more time to learn stuff off my own back!!