Advertisement

Wrong Color on "Bitmap Fonts"

Started by April 18, 2002 03:12 PM
1 comment, last by slashandburn 22 years, 10 months ago
Im using NeHe's "Bitmap Fonts" example in my project, And it will change colors or become darker based on what i render before the text. How can i fix this? [edited by - slashandburn on April 18, 2002 6:07:28 PM]
If you render it and before you use glColor*, then you have to call glColor3d(1,1,1) to make it original. If you render it with materials, then you need to disable lighting before rendering and then after enable it, and use glColor3d(1,1,1) as well if you used it before anywhere.
Cheers.

" Do we need us? "


Ionware Productions - Games and Game Tools Development

Advertisement
This is my code, What could bewrong?

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);


glLoadIdentity();
glTranslatef(0,-1,-6);
glCallList(miscmesh[17]);

glLoadIdentity();
glTranslatef(0,-1,-6);
glCallList(miscmesh[19]);

glLoadIdentity();
glTranslatef(0,-1,-6);
glCallList(miscmesh[20]);

glLoadIdentity();
glTranslatef(-3.4,2,-10.0);
glCallList(rustmesh);

glColor4f(1.0f,1.0f,1.0f,0.5f);
glBlendFunc(GL_SRC_ALPHA,GL_ONE);

glEnable(GL_BLEND);
glDisable(GL_DEPTH_TEST);

glLoadIdentity();
glTranslatef(0,-1,-6);
glCallList(miscmesh[18]);

glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);


//glDisable(GL_DEPTH_TEST);
glLoadIdentity();
glTranslatef(0.0f,0.0f,-10.0f);
glColor3f(1.0, 0.0, 0.0);
glRasterPos2f(-5.25,3.4);
glPrint("Land : ");
glPrint(data.info.name.c_str());
glRasterPos2f(-5.25,3.18);
glPrint("Fish : ");
glPrint("%3i",data.info.numberfish);
glRasterPos2f(-5.25,2.98);
glPrint("Evil : ");
glPrint("%3i",data.info.numberpred);
glRasterPos2f(-5.25,2.78);
glPrint("Info : ");
glPrint(data.info.description.c_str());

This topic is closed to new replies.

Advertisement