drawing text in OpenGL on OSX

Dear Lazyweb,

How do I draw normal flat text on top of an OpenGL scene using Quartz? I'm looking for the Mac equivalent of glXUseXFont() or wglUseFontBitmaps(): I just want to blast some text on the screen on top of the GL scene; I'm not interested in getting an image of the font into a texture, or scaling, rotating, occluding, spindling or mutilating it in any way.

Google has turned up a few things, but they all look insanely complicated (people giving the answer of "use the over-engineered library I wrote for that!" instead of just explaining it).

Update: Ok, it looks like aglUseFont() is what I want, but I don't get how to initialize AGL so that it can draw on my NSOpenGLView: if I ever call aglSetCurrentContext(), then regular GL activity stops showing up on the window at all (even if I never do any other AGL things). Are AGL and OpenGL fighting with each other? Do I have to synchronize aglChoosePixelFormat() with NSOpenGLPixelFormat somehow?

Update 2: I finally figured it out -- the answer is "you can't use NSOpenGLView when doing things that require an AGLContext, because NSOpenGLContext and AGLContext are orthogonal". But that's ok, because it turns out that NSOpenGLView doesn't really do much for you anyway: it just makes a context and keeps it current, and if you do that manually with the AGLContext, you can render GL onto any old NSWindow.

Tags: , , ,