Im trying to load fonts using FreeType2 and PSPGL and I have a strange problem:
http://img441.imageshack.us/my.php?image=testsq9.jpg
The text should look like this: Test Text
My loading code (a part of) :
Code: Select all
GLuint * tex_base;
(...)
GLubyte* expanded_data = new GLubyte[ 2 * width * height];
(...)
glBindTexture( GL_TEXTURE_2D, tex_base[(int)ch]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, expanded_data );
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, width, height, GL_RGBA, GL_UNSIGNED_BYTE, expanded_data);
Display code :
Code: Select all
string tekst;
(...)
/* FontData.textury=tex_base; */
glPushMatrix();
glTranslatef((float)a*h/3.0f,litery[(int)tekst.at(a)].y,0.0f);
glBindTexture(GL_TEXTURE_2D,FontData.textury[(int)tekst.at(a)]);
glBegin(GL_TRIANGLE_FAN);
glTexCoord2f(0,0);
glVertex2f(0,litery[(int)tekst.at(a)].vert_y);
glTexCoord2f(0,(float)litery[(int)tekst.at(a)].tx_cord_y);
glVertex2f(0,0);
glTexCoord2f((float)litery[(int)tekst.at(a)].tx_cord_x,(float)litery[(int)tekst.at(a)].tx_cord_y); glVertex2f(litery[(int)tekst.at(a)].vert_x,0);
glTexCoord2f((float)litery[(int)tekst.at(a)].tx_cord_x,0);
glVertex2f(litery[(int)tekst.at(a)].vert_x,litery[(int)tekst.at(a)].vert_y);
glEnd();
glPopMatrix();
Thanx!