Question

Does anyone know an easy way to draw arbitrary text in a Cocoa NSOpenGLView? I have a couple of constraints.

  • The text on screen may change from frame to frame (for example, a framerate display in the corner)
  • I would like to be able to select any font installed on the system at any size
Was it helpful?

Solution

Have you taken a look at the Cocoa OpenGL sample code? It includes "a texture class for strings, showing how to use an NSImage to write a string into and then texture from for high quality font rendering."

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top