views:

1079

answers:

1

What is an easy way to draw text in an opengl view. I need to be able to draw any/all characters (ie support not just english). Apple has a sample on how to do this for OpenGL (not ES) called GLstring.m which is neat, but cant be translated to iPhone.

Not all of us are writing applications just for Americans, ie Techniques that involve loading all characters into a bitmap need not apply, I want my applications to support languages other than english.

+1  A: 

This question is very similar to yours, and might provide some pointers.

Brad Larson
This approach doesnt work well in iPhone due to the texture size restrictions, textures must be a height and width of a power of two making it hard to squish textures into the right shape.
Jacob
If you weren't running into memory or GPU texture size limitations, you could pad out the rest of an irregularly sized texture and only display a section of that. You could also go the texture atlas route suggested by one answer, displaying each character as needed from one large texture. That larger texture would be easier to get into a power-of-two size.
Brad Larson
You might look at Brad Larson's answer here: ( http://stackoverflow.com/questions/512258/is-there-a-decent-opengl-text-drawing-library-for-the-iphone-sdk/512722#512722 ) which appears to sidestep your texture concern and directly addresses your localization support issue.
Alex Reynolds
Re "texture atlas" the problem with that is if you are going to just support only a few languages extra, ie chinese, japanese, korean, you are already needing to support 50,000 characters, so your looking at a 10Mb texture, which I am not sure would be possible?
Jacob