Advertisement

Weird-shaped Bitmap Fonts

Started by June 20, 2003 07:55 AM
3 comments, last by NeViL tHe dEVil 21 years, 8 months ago
I have a problem using my Bitmap Fonts: there shaped like this: ____________________ \ | \ | \ | \ | / | / | / | /__________________| (A square with a triangle missing out of the left side)
------------------------------------------------------ Regret Nothing - Learn Everything
You''re probably drawing the character as two triangles and have the coordinates mixed up. Your triangles currently look something like:
{ top-left, top-right, bottom-right }
{ top-right, bottom-right, bottom-left }
which should be something like
{ top-left, top-right, bottom-right }
{ top-left, bottom-right, bottom-left }


Kippesoep
Advertisement
Sorry about the picture I attempted above, it obviously didn''t come out very well. Here is my code for the BuildFont() function

GLvoid BuildFont() // Build Our Bitmap Font
{
base = glGenLists(256);
float cx;
float cy;
for(GLuint loop=0; loop<256; loop++)
{
cx=float(loop%16)/16.0f;
cy=float(loop/16)/16.0f;
glNewList(base+loop,GL_COMPILE);
glBegin(GL_QUADS);
glTexCoord2f(cx,1-cy-0.0625f);
glVertex3f(0,0,0);
glTexCoord2f(cx+0.0625f,1-cy-0.0625f);
glVertex3f(1,0,0);
glTexCoord2f(cx,1-cy);
glVertex3f(0,1,0);
glTexCoord2f(cx+0.0625f,1-cy);
glVertex3f(1,1,0);
glEnd();
glEndList();
}
}

As you can (hopefully) see, I am using GL_QUADS
------------------------------------------------------ Regret Nothing - Learn Everything
Use the [ source ] and [ /source ] tags for source code and the and tags for ASCII art.

Anyway, your vertices are still twisted. You specify the coordinates { top-left, top-right, bottom-left, bottom-right }, which is wrong. Specify vertice them in clockwise or anticlockwise order depending on the cull settings. So that would be {top-left, top-right, bottom-right, bottom-left }.

Kippesoep
Uuuuuuups... obviously wasn''t fully awake there! And thanks for the tips with the forum tags.
------------------------------------------------------ Regret Nothing - Learn Everything

This topic is closed to new replies.

Advertisement