Advertisement Jump to content
Sign in to follow this  

OpenGL Font Bitmaps Killing Frame Rate

This topic is 4888 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!