I've been trying to render text using glutBitmapCharacter().
This is what I've got so far as a 2D text rendering function:
void drawString(int x, int y, char* string) {
int i, len;
glDisable(GL_TEXTURE);
glDisable(GL_TEXTURE_2D);
glDisable(GL_LIGHTING);
glColor3f(1.0f, 0.0f, 0.0f);
glRasterPos2i(x, y);
for (i = 0, len = strlen(string); i < len; i++) {
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, (int)string[i]);
}
glEnable(GL_TEXTURE);
glEnable(GL_TEXTURE_2D);
glEnable(GL_LIGHTING);
}
In the scene rendering function, I make this call:
drawString(0, 0, "TESTING");
These are the only x and y values in which any text will be displayed, in which case "TESTING" appears in the middle of the screen with "TE" in red (the colour I want) and "STING" in black.
All the code for dealing with this function that I've seen has been using earlier versions of openGL and deprecated code, so I'm not sure what to do.