Results 1 to 2 of 2

Thread: problem changing fonts

  1. #1

    problem changing fonts

    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 of how it displays currently.

    Code :
    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.

  2. #2

    Re: problem changing fonts

    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.

Similar Threads

  1. fonts problem
    By Caner ERGUN in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-09-2003, 11:53 PM
  2. Replies: 9
    Last Post: 04-16-2003, 03:13 AM
  3. Weird problem with fonts...
    By 147-2 in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 11-05-2002, 06:23 AM
  4. Multiple fonts problem
    By kaysoft in forum OpenGL: Basic Coding
    Replies: 16
    Last Post: 10-12-2002, 09:35 PM
  5. Raster fonts problem
    By imported_Kaiser in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-19-2001, 06:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean