Using TextOut in OpenGL Window

I’ve been using wglFontBitmaps() for fonts. But found it is very slow expecially on Laptops with lower end graphics card while the slowing down was not noticeable on other systems. I’d like to use the fonts Windows provides.

So, my question is “How can I use TextOut() function for font on an OpenGL window while drawing other entities (lines, polygons) with functions OpenGL provides”

Thanks.

-KB

Don’t!

  • It will flicker because GDI is single buffered.
  • Using GDI rendering functions inside OpenGL windows won’t work under Vista.
  • It might even be slower than using font textures because the OpenGL pipeline needs to be synchronized before your GDI rendering.

If you need faster text rendering look for font libraries which use textures instead of glBitmap.
That also gives you the flexibility to print at any angle and smooth the fonts with texture filtering.