Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: problem with bitmap fonts and colors

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2006
    Location
    Germany
    Posts
    3

    problem with bitmap fonts and colors

    Hi,
    I use bitmap fonts:
    (...)
    baseHUDFont = glGenLists(96);
    font = CreateFont( -24,0,0,0,FW_BOLD,false, false,false,ANSI_CHARSET,OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS,ANTIALIASED_QUALITY, FF_DONTCARE|DEFAULT_PITCH,"Courier New");
    sfont = (HFONT)SelectObject(hDC, font);
    wglUseFontBitmaps(hDC, 32, 96, baseHUDFont);
    (...)
    (it's from NeHe tutorial

    and i display it:
    glColor3f(1.0f, 0.9f, 0.0f);
    glRasterPos2i(100, WIN_HEIGHT-50);
    glPushAttrib(GL_LIST_BIT);
    glListBase(baseMenuTitleFont - 32);
    glCallLists(strlen(title), GL_UNSIGNED_BYTE, title);
    glPopAttrib();

    My text is black, and I don't know why. What can influence on it? When I just clean the screen with glClear() the text is always black (no matter what color is used in glClearColor() ). When I put a red/gray texture on the screen first, the text is red in places where the texture is gray and gray where texture is red.

  2. #2
    Junior Member Newbie
    Join Date
    Mar 2006
    Location
    Germany
    Posts
    3

    Re: problem with bitmap fonts and colors

    Sorry, this text is red, let say #880000 - the color of this texture is changing smoothly from #000000 to #FF0000.

  3. #3
    Junior Member Regular Contributor
    Join Date
    May 2003
    Location
    Germany
    Posts
    232

    Re: problem with bitmap fonts and colors

    If you use bitmapfonts, then you'll have to disable texturing and (if used) lighting to get them displayed correctly.

  4. #4
    Junior Member Newbie
    Join Date
    Mar 2006
    Location
    Germany
    Posts
    3

    Re: problem with bitmap fonts and colors

    I call glDisable(GL_TEXTURE_2D) before drawing the text and now it works ok.

    Thanks very very much, you saved my ass

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •