Jump to content
  • Advertisement
Sign in to follow this  
litewarri

OpenGL Text color problem in OpenGL

This topic is 5422 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm using NeHe's Lesson 14 tutorial for OpenGL outline fonts. I got everything to work, for the most part... except the color of the font shows up black. Observe: Here is the slightly altered code I am using for the main draw function, from NeHe's tutorial: GLvoid glPrint(const char *fmt, ...) // Custom GL "Print" Routine { float length=0; // Used To Find The Length Of The Text char text[256]; // Holds Our String va_list ap; // Pointer To List Of Arguments if (fmt == NULL) // If There's No Text return; // Do Nothing va_start(ap, fmt); // Parses The String For Variables vsprintf(text, fmt, ap); // And Converts Symbols To Actual Numbers va_end(ap); // Results Are Stored In Text for (unsigned int loop=0;loop<(strlen(text));loop++) // Loop To Find Text Length { length+=gmf[text[loop]].gmfCellIncX; // Increase Length By Each Characters Width } glTranslatef(-length/2,0.0f,0.0f); // Center Our Text On The Screen glColor4f(1.0f,0.0f,0.0f,1.0f); glPushAttrib(GL_LIST_BIT); // Pushes The Display List Bits glListBase(base); // Sets The Base Character to 0 glCallLists(strlen(text), GL_UNSIGNED_BYTE, text); // Draws The Display List Text glPopAttrib(); // Pops The Display List Bits } As you can see, I have a color method called in there. But it doesn't do anything. NeHe's program, of course, has colors working. What are some possible causes of all-black text?

Share this post


Link to post
Share on other sites
Advertisement
glTexEnvf....GL_MODULATE in case the tutorial is the one with bitmap fonts or disable light if you're using blending

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!