开发者

How to create opengl texture from text generated by method 'drawAtPoint: withFont:'

I am trying to render texture dynamically in my opengl application.

Basically I am tring to use (CGSize)drawAtPoint:(CGPoint)point with开发者_如何学编程Font:(UIFont *)font and capture it to a texture. But I am not able to figure out how to convert CGContext stuff to texture.


I'm not sure this is the answer you are looking for, but maybe (maybe) you can capture a bitmap of your current view with CGBitmapContextGetData, plug it into a NSImage and write the code to recognize/crop it. I don't know how you load textures in OpenGL (haven't looked that up yet) but I know for certain it is possible to go from NSImage to OpenGL texture one way or another. If you don't mind a crude solution you could write it to the disk and load it that way. Apple probably put something in their API's to avoid this but I'm not sure. This was mostly a conceptual answer.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜