Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Black Bitmap Fonts Problem

This topic is 5805 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

Hiya, bit of a problem with colouring my fonts in my scene, they draw correctly (That is on top of everything) but the problem is they are black, despite the presence of a glColor3f statement with 1.0f, 0.0f, 0.0f as paramaters. I''ve pasted the drawGLScene code below so you can see, if you''d care to look int DrawGLScene(GLvoid) { /* Movement Variables */ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear screen in color selected in InitGL() function glMatrixMode(GL_MODELVIEW); // Set Matrix To ModelView glLoadIdentity(); // Resets Co-Ordinate system. glBindTexture(GL_TEXTURE_2D, bmptexture[0]); // Bind Space Texture DrawSpace(); // Draw the Space Texture glEnable(GL_LIGHTING); // Enable Lighting (Turn it ON) CameraView(x_cam, y_cam, z_cam, roll_cam, pitch_cam, heading_cam); // Start Position glTranslatef(0.0f, 0.0f,-25.0f); // Translate 25 units into the screen for (loop=0; loop<10; loop++) { glPushMatrix(); // Store Current Position Light_1_Setup(); // Set Light Position Relative To Scene (Otherwise Light will move with viewport transformation) glEnable(GL_LIGHT1); // Enable Light1. // glColor3f(0.0f, 0.0f, 1.0f); // Alter To Change Color Of Scene (or Planet) 1 , 1 , 1 is default // Auto loaded by scene // glPolygonMode( GL_FRONT, GL_LINE ); // Sets Back Polygons to Line Mode // glPolygonMode( GL_BACK, GL_LINE ); // Sets Front Polygons to Line Mode // glDisable(GL_TEXTURE_2D); glRotatef(planet[loop].selfmove, 0.0f, 1.0f, 0.0f); glTranslatef(planet[loop].distance, 0.0f, 0.0f); glRotatef(planet[loop].bodymove, 0.0f, 1.0f, 0.0f); glRotatef(-90, 1.0f, 0.0f, 0.0f); // Rotates so Spheres are Drawn the correct way up if (planet[loop].atmos_phere != 0) { glEnable(GL_BLEND); glDepthMask( GL_FALSE ); // Turn Depth Buffer Writes OFF glBindTexture(GL_TEXTURE_2D, bmptexture[planet[loop].atmos_texid]); DrawSphere(planet[loop].radius + 0.05f, 32, 32); glDepthMask( GL_TRUE ); // Turn Depth Buffer Writes ON glDisable(GL_BLEND); } glBindTexture(GL_TEXTURE_2D, bmptexture[planet[loop].texture]); // Select Texture[0] DrawSphere(planet[loop].radius, planet[loop].sub_x, planet[loop].sub_y); if (planet[loop].name == "Saturn") // Draws Saturns Rings { glBindTexture(GL_TEXTURE_2D, bmptexture[planet[loop].texture]); glEnable(GL_BLEND); DrawCylinder(1.5f, 1.5f, 0.05f, 32, 32); DrawDisc(planet[loop].radius + 0.05f, 1.5f, 32, 32); glDisable(GL_BLEND); } glPopMatrix(); /* Start Draw Particle Here */ glPushMatrix(); // Store The Current Matrix Settings glDisable(GL_LIGHTING); // Disables Lighting glEnable(GL_BLEND); // Blend The Particles glDepthMask(GL_FALSE); // Disable Depth Buffer Writes DrawSunRing(); // Calls Draw Sun Ring Function // DrawParticle(); glColor3f(1.0f, 1.0f, 1.0f); // Reset Scene Color glDisable(GL_BLEND); // Disable Blending glDepthMask(GL_TRUE); // Enable Depth Buffer Writes glEnable(GL_LIGHTING); // Enable Lighting glPopMatrix(); // Restore The Matrix Settings /* End Draw Particle Here */ planet[loop].bodymove = planet[loop].bodymove + planet[loop].bodyrot; planet[loop].selfmove = planet[loop].selfmove + planet[loop].selfrot; if ( planet[loop].selfmove > 360) { planet[loop].selfmove = 0.0f; } } glDisable(GL_LIGHTING); // Disable Lighting (Turn it OFF) // ** Font Drawn To Screen Here ** glLoadIdentity(); glDisable(GL_DEPTH_TEST); glTranslatef(0.0f, 0.0f,-25.0f); glRasterPos2f(0.0f, 0.0f); glColor3f(1.0f, 0.0f, 1.0f); glPrint("Blah Blah Blah Blah"); glColor3f(1.0f, 1.0f, 1.0f); glEnable(GL_DEPTH_TEST); return TRUE; } Some stuff is commented out because its a direct C&P job Sorry about that, I hope you can understand it . Also, the code for the font printing is from NeHe''s tutorial 13 Any help much appericated. Plates.

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Try disabling 2D texturing before printing out fonts and then re-enabling it afterwards...

Share this post

Link to post
Share on other sites
Try :


glPrint("Blah Blah Blah Blah");


Leyder Dylan

Share this post

Link to post
Share on other sites
I tried both suggestions, the first one (disabling Texture 2d) worked kind off, but the text is white, and won''t change colour (must think its got a texture mapped to it?) the second, blending suggestion, alas, had no joy - any other ideas, be appericated



Share this post

Link to post
Share on other sites
Hello brother,

Try using

glColor4ub(red value between 0..255, green value between 0..255, blue value between 0..255, 255);

use it before calling the print function and after Disabling Texutre 2D ...

please let me know if it works or not ...

"If you don''''t like something, change it. If you can''''t change it, change the way you think about it!"

"He who asks is a fool for five minutes, but he who does not ask remains a fool forever."

"Imagination is more important than knowledge, for knowledge is limited while imagination embraces the entire world."(Einstein)

"The normal teacher tells. The good teacher explains. The superior teacher demonstrates. The great teacher inspires."(William Arthur Ward)

Share this post

Link to post
Share on other sites
I had a similar problem and found that disabling lighting and 2D texture seemed to solve the problem. The following is a print text segment:

glPrint(0,430,"Some boring text goes here");


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!