// GLuint dwBaseFont;
void LoadFont(char *szFontName)
{
//-----------------------//
// Locals
//-----------------------//
HFONT hFont;
//----------------------//
// Generate List //
//----------------------//
dwBaseFont = glGenLists(256);
hFont = CreateFont(-24, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE,
ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS,
ANTIALIASED_QUALITY, FF_DONTCARE|DEFAULT_PITCH,
szFontName);
SelectObject(hdc,hFont);
wglUseFontBitmaps(hdc, 0, 256, dwBaseFont);
}
void glPrint(char *szString)
{
if (szString == NULL)
return;
glColor3f(1.0f,0.0f,0.0f);
glPushAttrib(GL_LIST_BIT);
glListBase(dwBaseFont);
glRasterPos2i(0,0);
glCallLists(strlen(szString), GL_UNSIGNED_BYTE, szString);
glPopAttrib();
}
I don''t get anything on the screen when I call glPrint and swap the buffers.
OGL Font Problem.
Could you guys quickly check this code over for major errors. Cause I can''t get it to work. It''s driveing me nuts. All variables are defined. I included some in comments at the top.
If you don''t have proper hardware support for OpenGL you may get problems using raster functions in fullscreen mode - try running the app in a window. There is a way around this, I hear, but I got a GeForce2 instead of bothering to find out what it was. I think the solution may be buried somewhere in one of the NeHe tutorials.
Geocyte Has Committed Suicide.
Geocyte Has Committed Suicide.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement