Original Post
I have some OpenGL code based on NeHe''s code for useing fonts in OpenGL. The program works on several computers except for my laptop and its old video drivers
When the program is run it locks up at the point where it is displaying the font TitleFont (see code below). Using old drivers that I found it works but performance is terrible. Below is the code I used to initialize the fonts; please tell me I''m doing something wrong and its not that my laptop can''t handle fonts in OGL!
HFONT font; // Windows Font ID
HFONT oldfont; // Used For Good House Keeping
TitleFont = glGenLists(96);
font = CreateFont( -150,
0,
0,
0,
FW_NORMAL, // Font Weight
FALSE, // Italic
FALSE, // Underline
FALSE, // Strikeout
ANSI_CHARSET,
OUT_TT_PRECIS,
CLIP_DEFAULT_PRECIS,
ANTIALIASED_QUALITY,
FF_DONTCARE|DEFAULT_PITCH,
"SolsticeOfSuffering");
oldfont = (HFONT)SelectObject(hDC, font);
wglUseFontBitmaps(hDC, 32, 96, TitleFont);
SelectObject(hDC, oldfont);
DeleteObject(font);
MenuFont = glGenLists(96);
font = CreateFont( -72,
0,
0,
0,
FW_NORMAL, // Font Weight
FALSE, // Italic
FALSE, // Underline
FALSE, // Strikeout
ANSI_CHARSET,
OUT_TT_PRECIS,
CLIP_DEFAULT_PRECIS,
ANTIALIASED_QUALITY,
FF_DONTCARE|DEFAULT_PITCH,
"SHLOP");
oldfont = (HFONT)SelectObject(hDC, font);
wglUseFontBitmaps(hDC, 32, 96, MenuFont);
SelectObject(hDC, oldfont);
DeleteObject(font);
NormalFont = glGenLists(96);
font = CreateFont( -50,
0,
0,
0,
FW_NORMAL, // Font Weight
FALSE, // Italic
FALSE, // Underline
FALSE, // Strikeout
ANSI_CHARSET,
OUT_TT_PRECIS,
CLIP_DEFAULT_PRECIS,
ANTIALIASED_QUALITY,
FF_DONTCARE|DEFAULT_PITCH,
"Shlop");
oldfont = (HFONT)SelectObject(hDC, font);
wglUseFontBitmaps(hDC, 32, 96, NormalFont);
SelectObject(hDC, oldfont);
DeleteObject(font);
I use the following code to draw the fonts to the screen:
void DrawString(int x, int y, unsigned int base, char *str, int displacement = 32)
{
glRasterPos2i(x, y);
if ((base == 0) || (str == NULL))
return;
glPushAttrib(GL_LIST_BIT);
glListBase(base - displacement);
glCallLists(strlen(str), GL_UNSIGNED_BYTE, str);
glPopAttrib();
return;
}
Wizzard
rhollencamp@zoominternet.net