Skip to main content
gamedev.net
🔒 Locked

Text Methods....

Started by Mindar Dec 27, 2004 at 3:02 PM 8 replies 900+ views
Original Post
Mindar
Mindar
Hey, I was wondering what are some different methods to make some text functions to display text on the screen using a bitmap with letters on it. The search isnt working right now, so I cant really find anything that way. I was wondering if you would create an image surface, some matrices, or some other method. If someone could point me towards some tutorials, that would be great. Thanks!
Stevieboy
Stevieboy
I was hoping for some answers to this as well, at the moment I'm using one 256*256 tga file with all the characters on it and I adjust the tu & tv coordinates to show one character at a time.
Mindar
Mindar
Yea, thats what I was thinking of doing, but i was wondering if there was a more optimized way of doing it.
Stevieboy
Stevieboy
I really don't know, I haven't had time to check it out properly yet. I thought of using surfaces as well, but I'm sure I remember that matrices can be used.
Mindar
Mindar
Actually I have a nifty book that I found that explains how to use surfaces for tilling a map for an rpg, but I dont think there would be a difference for text.

I'll post the snippet of the code later, but my grandma just came.

Ttyl.
IFooBar
IFooBar
Have you guys tried using the ID3DXFont interface? It's optimized and *very* flexible.
[size=2]aliak.net
Mindar
Mindar
can you use custom bitmaps? I like being able to make my own fonts. If so, can someone point me towards a good tutorial?
Holy Fuzz
Holy Fuzz
The recommended way is to use one large texture in video memory with all the printable characters on it, and adjust the texture coordinates appropriately for each letter.

How you get this texture depends. You can load it from a custom image file, or you can generate it at runtime (i.e, use GDI to draw the characters onto the texture when your app loads).

ID3DXFont is also a very viable alternative. It's very fast and reasonably flexible. It should usually do the trick unless you have some specific feature that ID3DXFont does not posess.
dave
dave
Quote:
Original post by Holy Fuzz
The recommended way is to use one large texture in video memory with all the printable characters on it, and adjust the texture coordinates appropriately for each letter.

How you get this texture depends. You can load it from a custom image file, or you can generate it at runtime (i.e, use GDI to draw the characters onto the texture when your app loads).

ID3DXFont is also a very viable alternative. It's very fast and reasonably flexible. It should usually do the trick unless you have some specific feature that ID3DXFont does not posess.


... or you fancy learning it for urself.

Go with textured quads, look at my site for one in my X-Engine i wrote ages ago.

See sig.

ace
load_bitmap_file
load_bitmap_file
Quote:
Original post by ace_lovegrove
Quote:
Original post by Holy Fuzz
The recommended way is to use one large texture in video memory with all the printable characters on it, and adjust the texture coordinates appropriately for each letter.

How you get this texture depends. You can load it from a custom image file, or you can generate it at runtime (i.e, use GDI to draw the characters onto the texture when your app loads).

ID3DXFont is also a very viable alternative. It's very fast and reasonably flexible. It should usually do the trick unless you have some specific feature that ID3DXFont does not posess.


... or you fancy learning it for urself.

Go with textured quads, look at my site for one in my X-Engine i wrote ages ago.

See sig.

ace


Well, the OP's asking for a function to print text, not how to; it sounds like they just want to stick text on the screen without having to roll their own. Also, as the previous posters and the forum FAQ says, ID3DXFONT is very fast and it's very doubtful you could write a faster solution. It's really simple to get working, too. I like it :]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.