baggins
02-24-2003, 12:25 AM
hi, i've been having some irritating problems recently with my own implementation of a font using a single texture with a display list for each character which draws a quad (or a two-triangle strip) from a GL_T2F_V3F vertex array with the appropriate texture coordinates.
Two examples of the unwanted pixels can be found here:
http://pix.hobbiton.cjb.net/bill/screenshots/quads.png
http://pix.hobbiton.cjb.net/bill/screenshots/triangles.png
a snippet of the code i use to generate a display lists for a character:
fontelement[0][0]=float(cursor.x)/float(fontSurf->w);
fontelement[0][1]=float(cursor.y)/float(fontSurf->h);
fontelement[1][0]=float(cursor.x+cursor.w)/float(fontSurf->w);
fontelement[1][1]=float(cursor.y)/float(fontSurf->h);
fontelement[2][0]=float(cursor.x+cursor.w)/float(fontSurf->w);
fontelement[2][1]=float(cursor.y+cursor.h)/float(fontSurf->h);
fontelement[3][0]=float(cursor.x)/float(fontSurf->w);
fontelement[3][1]=float(cursor.y+cursor.h)/float(fontSurf->h);
fontelement[0][2]=0.0f;
fontelement[0][3]=cursor.h;
fontelement[1][2]=cursor.w;
fontelement[1][3]=cursor.h;
fontelement[2][2]=cursor.w;
fontelement[2][3]=0.0f;
fontelement[3][2]=0.0f;
fontelement[3][3]=0.0f;
glNewList(base+ch-g1,GL_COMPILE);
glInterleavedArrays(GL_T2F_V3F,0,fontelement);
glDrawArrays(GL_QUADS,0,sizeof(fontelement)/sizeof(GLfloat));
glTranslatef(glyphSurfs[ch-g1]->w,0.0f,0.0f);
glEndList();
and i render it with primarily these calls:
glBindTexture(GL_TEXTURE_2D,getTexture());
glListBase(base-32);
glPushMatrix();
glCallLists(s.size(),GL_UNSIGNED_BYTE,s.c_str());
glPopMatrix();
if you think you can help and need more information, or have had any similar problems in the past then please let me know. thanks
-bill
Two examples of the unwanted pixels can be found here:
http://pix.hobbiton.cjb.net/bill/screenshots/quads.png
http://pix.hobbiton.cjb.net/bill/screenshots/triangles.png
a snippet of the code i use to generate a display lists for a character:
fontelement[0][0]=float(cursor.x)/float(fontSurf->w);
fontelement[0][1]=float(cursor.y)/float(fontSurf->h);
fontelement[1][0]=float(cursor.x+cursor.w)/float(fontSurf->w);
fontelement[1][1]=float(cursor.y)/float(fontSurf->h);
fontelement[2][0]=float(cursor.x+cursor.w)/float(fontSurf->w);
fontelement[2][1]=float(cursor.y+cursor.h)/float(fontSurf->h);
fontelement[3][0]=float(cursor.x)/float(fontSurf->w);
fontelement[3][1]=float(cursor.y+cursor.h)/float(fontSurf->h);
fontelement[0][2]=0.0f;
fontelement[0][3]=cursor.h;
fontelement[1][2]=cursor.w;
fontelement[1][3]=cursor.h;
fontelement[2][2]=cursor.w;
fontelement[2][3]=0.0f;
fontelement[3][2]=0.0f;
fontelement[3][3]=0.0f;
glNewList(base+ch-g1,GL_COMPILE);
glInterleavedArrays(GL_T2F_V3F,0,fontelement);
glDrawArrays(GL_QUADS,0,sizeof(fontelement)/sizeof(GLfloat));
glTranslatef(glyphSurfs[ch-g1]->w,0.0f,0.0f);
glEndList();
and i render it with primarily these calls:
glBindTexture(GL_TEXTURE_2D,getTexture());
glListBase(base-32);
glPushMatrix();
glCallLists(s.size(),GL_UNSIGNED_BYTE,s.c_str());
glPopMatrix();
if you think you can help and need more information, or have had any similar problems in the past then please let me know. thanks
-bill