Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to draw text with OpenGL and Cocoa?

Tags:

cocoa

opengl

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
like image 777
Jay Conrod Avatar asked Sep 10 '08 01:09

Jay Conrod


1 Answers

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

like image 174
Hagelin Avatar answered Sep 20 '22 10:09

Hagelin