I want to render an NSString to a monochrome OpenGL texture. I found many examples on how to to that on iOS, but I’m struggling to find a code snippet that works on OSX.
I know how to do the last bit, uploading a texture to the GPU, but how do I get the raw (8 bit per pixel) data?
Take a look at GLString.m in Apple’s Cocoa OpenGL code sample. You can easily modify it to generate a monochrome texture. The relevant modifications result in code that looks like so:
The key parts are: