Odd texture-mapped font rendering

Started by
3 comments, last by IronFox 14 years ago
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);
Advertisement
How do you load/initialize/etc your texture?
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.
Are non power of two textures supported by your system?
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.

This topic is closed to new replies.

Advertisement