Jump to content
  • Advertisement
Sign in to follow this  
ChemicalImbalance

OpenGL Font Bitmaps Killing Frame Rate

This topic is 4767 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);
	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();
}

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

Share this post


Link to post
Share on other sites
Advertisement
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 GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!