OpenGL bitmap fonts (NeHe lesson 13) and textures
I am learning opengl from NeHe tutorials and I am currently on bitmap fonts: lesson 13; for learning purposes I wanted to add a shape with a texture for refreshing my memory and I have found a bug.
When ever I load a texture the text that prints turns a very dark color. I have found to stop this from happening I use glDisable(GL_TEXTURE_2D); and then enable it to draw the texture.
Code:
glDisable(GL_TEXTURE_2D);
Courier.printf("I AM A BANANA");
glEnable(GL_TEXTURE_2D);
I am still getting a bug. The first charactor that prints out is still that dark color I mentioned earlier; the rest of the text is fine though. The printf function looks like this:
Code:
void Text::printf(const char *fmt, ...)
{
char text[256];
va_list ap;
if (fmt == NULL)
return;
va_start(ap, fmt);
vsprintf(text,fmt,ap);
va_end(ap);
glPushAttrib(GL_LIST_BIT);
glListBase(base-32);
glCallLists(strlen(text),GL_UNSIGNED_BYTE, text);
glPopAttrib();
}
What do I need to do to fix it. Thanks for any help.