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

Ascii image to texture

Started by ChristOwnsMe Dec 29, 2012 at 9:38 AM 1 replies 1.4k views
Original Post
ChristOwnsMe
ChristOwnsMe

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.

RDragon1
RDragon1

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

PhilObyte
PhilObyte

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.

Topic Locked

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

Sign in to reply to this topic.