Sign in to follow this  

Odd texture-mapped font rendering

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

This topic is 2816 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this