PDA

View Full Version : problem with bitmap fonts and colors



mIc
01-05-2004, 03:43 PM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif

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.

mIc
01-05-2004, 04:07 PM
Sorry, this text is red, let say #880000 - the color of this texture is changing smoothly from #000000 to #FF0000.

PanzerSchreck
01-06-2004, 01:28 AM
If you use bitmapfonts, then you'll have to disable texturing and (if used) lighting to get them displayed correctly.

mIc
01-06-2004, 06:43 AM
I call glDisable(GL_TEXTURE_2D) before drawing the text and now it works ok.

Thanks very very much, you saved my ass http://www.opengl.org/discussion_boards/ubb/smile.gif