Sign in to follow this  

OpenGL Font Bitmaps Killing Frame Rate

Recommended Posts

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...
//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);

//Outputting to screen
OpenGLFont::printf(const char* format, ...)
	char str[500];
	va_list arg;

	va_start(arg, format);
		vsprintf(str, format, arg);

		glListBase(ListBase - 32);
		glCallLists(strlen(str), GL_UNSIGNED_BYTE, str);

[Edited by - phantom on September 6, 2005 7:13:41 AM]

Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this