Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting glutBitmapCharacter color?

Just wondering if someone can help me track down my issue with the following code where the text color is not being set correctly (its just rendering whatever color is in the background)

void RenderText(int x, int y, const char *string)
{
int i, len;

glUseProgram(0);

glLoadIdentity();
glColor3f(1.0f, 1.0f, 1.0f);
glTranslatef(0.0f, 0.0f, -5.0f);
glRasterPos2i(x, y);

glDisable(GL_TEXTURE_2D);
for (i = 0, len = strlen(string); i < len; i++)
{
    glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int)string[i]);
}
glEnable(GL_TEXTURE_2D);
}

I've checked all the usual things (I think), disabling texturing, setting color before rasterPos'ing, etc Ive disabled shaders but Im still having issues

like image 865
colordot Avatar asked Apr 16 '10 20:04

colordot


1 Answers

Looks like you've forgotten to glDisable(GL_LIGHTING) before drawing your string.

like image 161
Martin Hennig Avatar answered Sep 22 '22 19:09

Martin Hennig