开发者

How to draw outline text on OpenGL ES context in iOS?

I'm trying to draw text on OpenGL ES context on iOS platform. I have to draw rich-text with outline font (TTF, OTF or others)

I know two outline 开发者_Python百科text drawing library.

  1. CoreText
  2. FreeType

There is a default text framework in iOS CoreText. I know how to use it, but only for CGContext. What should I do to draw on OpenGL ES context? Should I draw on CoreGraphics bitmap and copy it to OpenGL ES?

I have no experience about FreeType. Is it similar with CoreText?

What's the recommended way to draw outline font drawing on OpenGL ES context?

Note: My application is soft-realtime game.


There's some Apple sample code that uses Quartz 2D, rendering nicely anti-aliased text to a texture. I used it for a debug HUD in a game a couple years ago. The performance wasn't great, but if you don't have to re-render every frame that approach should work.

Sorry I can't recall the exact details of the sample code. But you'd create a bitmap context, render to that, and then make it a texture. (This should work with CoreText too.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜