Friday, January 21, 2011

Best way to draw text with OpenGL and Cocoa?

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
  • 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."

    From Hagelin

0 comments:

Post a Comment