Ascii image to texture

Started by
1 comment, last by PhilObyte 11 years, 3 months ago

Hello. I want to be able to convert an ascii file into a texture, where the texture is composed of the characters in the ascii file. For instance, if I had a 3x3 ascii file that looked like this.

@@@

@@@

@@@

I want to be able to generate a texture that is some given size, say 512x512, that has those 9 ascii characters on the texture(with the same rows and columns). I have not been able to think of a good way to do this, and I need to be able to do it dynamically. Any ideas? Thanks.

Advertisement

get a font renderer (or write one), and render the text to a texture

If you are using XNA you can draw a string with the normal SpriteBatch to a specific RenderTarget and then store it in a Texture2D.

You can even save it as JPG oder PNG with one line.

This topic is closed to new replies.

Advertisement