View Full Version : generating/mapping text onto surfaces
04-18-2001, 05:28 AM
What is the fastest way to take a text string and map it onto a surface?
As an example, I would like to take a value and map it onto the bottom of the front face of its corresponding 3d bar on a 3d bar chart. Thanks in advance.
normally u have a texture with the whole alphabet in it.
and then you pass a string to your drawtext function eg str = "abc"
then you loop through all the characters of the string
eg str == 'a' == 65 (ascii), str == 'b' == 66 (ascii).
depending on what the ascii value of the character is you can easily find what texture coordinates to use for that character.
check the faq for more info
04-19-2001, 07:06 PM
Zed - Thanks, but I wasn't clear enough.
The font is not fixed ahead of time, so I need to procedurally generate the text textures. I guess once I have a texture with all of the letters on/in it, I can extract just the portion with each letter on it, then "paste" each individual letter texture onto a surface - why not just generate one texture with the entire string on it and map that onto the target surface? - that's what I would like to know how to do - thanks.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.