PDA

View Full Version : problem changing fonts



pouljin
11-29-2010, 09:31 PM
I'm having a bit of trouble setting up the font for the text in my app.

It renders the text just fine, but it only seems to display in a default font. The changes I make in CreateFont don't seem to be reflected inside the app.

Here are the excerpts I use to create and render the font.

I stepped through the font creation and it seems to be executing fine, but I can comment out the CreateFont and SelectObject lines and it will still render as seen in the below linked screen capture. Any help would be greatly appreciated.



Here is a Screenshot (http://yfrog.com/f/0hfreeworld20101129222246j/) of how it displays currently.



void Interface::SetupFont(HDC &g_HDC)
{
*basefont = glGenLists(256);
*hfont = CreateFont(24,0,0,0,FW_BOLD,false, false, false, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH, "Times New Roman");

if (*hfont)
{
SelectObject(g_HDC, hfont);
wglUseFontBitmaps(g_HDC, 32, 96, *basefont);
}
}


void Interface::WriteFPS()
{
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glDisable(GL_BLEND);
realTime_->CalculateFrameRate();
glTranslatef(0.0f, 0.0f, -1.0f);
glRasterPos2f(0.2, 0.486f);
glPushAttrib(GL_LIST_BIT);
glListBase(*basefont - 32);
glCallLists(strlen(realTime_->getStrFrameRate()), GL_UNSIGNED_BYTE, realTime_->getStrFrameRate());

glPopAttrib();
glPopMatrix();
}




For reference in case it matters I'm using Dev. Studio 2005 and Vista 64 bit.

pouljin
11-30-2010, 10:13 PM
Any ideas at all would be appreciated. Or if you need more info to figure it out let me know and I will get you the info.