How to create opengl texture from text generated by method 'drawAtPoint: withFont:'
(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.
精彩评论