//Font Loading...
OpenGLFont::Create(int Points, char* FontName, HDC dc, int Quality)
{
HFONT font;
HFONT oldfont;
ListBase = glGenLists(96);
font = CreateFont(-Points, 0, 0, 0, FW_BOLD, false, false, false, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, Quality, FF_DONTCARE|DEFAULT_PITCH, FontName);
oldfont = (HFONT)SelectObject(dc, font);
wglUseFontBitmaps(dc, 32, 96, ListBase);
SelectObject(dc, oldfont);
DeleteObject(font);
}
//Outputting to screen
OpenGLFont::printf(const char* format, ...)
{
char str[500];
va_list arg;
va_start(arg, format);
vsprintf(str, format, arg);
va_end(arg);
glPushAttrib(GL_LIST_BIT);
glListBase(ListBase - 32);
glCallLists(strlen(str), GL_UNSIGNED_BYTE, str);
glPopAttrib();
}
Font Bitmaps Killing Frame Rate
I'm using the wglUseFontBitmaps method of displaying text as shown in NeHe lesson 13. It's killing my frame rate (taking me down from 60 to about 40) just by outputting a line of text.
Rotating textured solids, using lighting, etc. None of these things have this effect. Is there a faster method?
What am I doing wrong here? I've hardly modified lesson 13 at all...
[Edited by - phantom on September 6, 2005 7:13:41 AM]
I don't know, how does this font implemented. Is it the single 2D texture for all characters? Or it has a unique texture for every character?
If it is as in the second, so, frame-rate dropping is desirable, cause of texture switching.
If it is as in the second, so, frame-rate dropping is desirable, cause of texture switching.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement