Jump to content
  • Advertisement
Sign in to follow this  
Cyndar

Odd texture-mapped font rendering

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

Okay, so, I'm trying to load and display a texture-mapped font in my program, however, whenever I try to display it (Regardless of how) it displays as: http://i69.photobucket.com/albums/i58/bahamut1993/BadFont.jpg When it should be displaying as: http://i69.photobucket.com/albums/i58/bahamut1993/Font.png
    glColor4d(1,1,1,1);
    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D,FontTex);
    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
    glDisable(GL_LIGHTING);
    glBegin(GL_QUADS);
    glTexCoord2d(0,0);
    glVertex2d(15,15);
    glTexCoord2d(1,0);
    glVertex2d(527,15);
    glTexCoord2d(1,1);
    glVertex2d(527,23);
    glTexCoord2d(0,1);
    glVertex2d(15,23);
    glEnd();
    glDisable(GL_TEXTURE_2D);
    glEnable(GL_LIGHTING);

Share this post


Link to post
Share on other sites
Advertisement
GLuint LoadTexture(char* fname)
{
TGAImg Img;
GLuint Texture;
Img.Load(fname);
glGenTextures(1,&Texture);
glBindTexture(GL_TEXTURE_2D,Texture);
glTexImage2D(GL_TEXTURE_2D,0,4,Img.GetWidth(),Img.GetHeight(),0,GL_RGBA,GL_UNSIGNED_BYTE,Img.GetImg());
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
return Texture;
}


Everything else renders correctly. Even other RGBA textures. It just seems that lighter colors bleed through darker ones in RGBA textures.

Share this post


Link to post
Share on other sites
What exactly is the issue? That the background bleeds through? The characters appear to be of the correct size for all i can tell.
I can't recall whether
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
overrides the blend equation or not. Did you customize the blend equation? You could try glDisable(GL_BLEND) and see what happens.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!