iPhone Game - Open GL ES - How to Display an Integer?
Just a quick question. I have written a game in Open gles. How can I render a val开发者_开发技巧ue such as an integer on the screen ? (In this case int level).
I don't think open gl has any font support, but there are a few font libraries knocking about the internet. There is some discussion of that here:
Is there a decent OpenGL text drawing library for the iPhone SDK?
I needed to do the same thing as you, that fonts are probably overkill for. So, I simply made an array of images 0 to 9, then broke down the integer into a series of those images, by using % 10 to find which digit, then / 10 to move onto the next (more significant) digit.
精彩评论