Skip to main content
GameDev.net gamedev.net
🔒 Locked

Texture Fonts

Started by Games Apprentice Jul 18, 2009 at 4:10 AM 3 replies 700+ views
Original Post
Games Apprentice
Games Apprentice
Hi, I'm also a beginner in game development... may I ask how I can use textures as fonts to my game, instead of text fonts? How do I implement it? I'm using C++ W32, Direct X programming. Some examples maybe, or links that could help. Thank You very much! :)
Ron AF Greve
Ron AF Greve
Hi,


You could use Windows fonts to write to a bitmap (lookup CreateDIBSection and fonts in general) and then use that bitmap a a texture. (Thats how I do it).

Ron AF Greve
Games Apprentice
Games Apprentice
Quote:
Original post by Ron AF Greve
Hi,


You could use Windows fonts to write to a bitmap (lookup CreateDIBSection and fonts in general) and then use that bitmap a a texture. (Thats how I do it).


I wanted to try like for instance I have a texture 'fonts.dds', how do i render those fonts representing the letters? I'm aware that I should create a class for alphabets. I just haven't figure out how I'd render them to the screen. Do I use an array of ID3DXTexture for each mapped letters?

Any ideas? Thanks!
tnutty
tnutty
Try "masking" it.
Our whole life is a opengl application.
Ron AF Greve
Ron AF Greve
Hi,

I use a simple bitmap i.e. just an area of RGB values. I then use a map of those bitmaps (I just use the ascii codes but I could use unicode as well since the characters are just indexes in the map The font class has width, height etc. as well as the actual image of the character. You can then just copy that image to a certain position on the texture (probably advancing some write pointer to keep track of the position in the texture). Finally send the texture to the graphics card and render to a bunch of triangles

Don't forget to lookup directx rasterizing otherwise you might be in for a surprise in that the text is unreadable.
Ron AF Greve

Topic Locked

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

Sign in to reply to this topic.