Hi
Anyone know if its possible to maintain sets of font lists
(wglUseFontBitmaps - MS windows)) across multiple opengl rendering contexts.
Here its actually a single opengl window, that is closed and opened by the
user, creating font lists on each window creation is rather expensive.
Both the opengl rendering context and windows HDC are lost - so is it
possible to hold on to a list between contexts ?
Thanks
Typical code we are using is
unsigned int base; // Base display list for font
HFONT font; // Windows font ID
// create rendering context and make it
current
hRC = wglCreateContext(hDC);
wglMakeCurrent(hDC, hRC);
if ((base = glGenLists(96)) == 0)
return (0);
if (stricmp(typeface, “symbol”) == 0) // font symbols a bit different
font = CreateFont(height, 0, 0, 0, weight, italic, FALSE, FALSE,
SYMBOL_CHARSET, OUT_TT_PRECIS,
CLIP_DEFAULT_PRECIS, DRAFT_QUALITY,
DEFAULT_PITCH, typeface);
else
font = CreateFont(height, 0, 0, 0, weight, italic, FALSE, FALSE,
ANSI_CHARSET, OUT_TT_PRECIS,
CLIP_DEFAULT_PRECIS, DRAFT_QUALITY,
DEFAULT_PITCH, typeface);
HGDIOBJ hOldFont = ::SelectObject(hdc, font);
BOOL fRC = wglUseFontBitmaps(hdc, 32, 96, base);
::SelectObject(hdc, hOldFont);