Sign in to follow this  
phook

FTGL Pixmap font problem

Recommended Posts

hello, I started recently using FTGL to do font rendering and I got a problem using Pixmap fonts, I sometimes get a black background http://i869.photobucket.com/albums/ab253/phook/untitled.png here's the code
FTPixmapFont font("arial.ttf");
font.FaceSize(28);
//.....
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
{
	glRotatef(Vangle, 1, 0, 0);
	glRotatef(Hangle, 0, 1, 0);
	glTranslatef(-Cam.x, -Cam.y, -Cam.z);
	DrawText(1000.0, 770.0, &font, 28, "X: %.1f, Y: %.1f, Z: %.1f", Cam.x, Cam.y, Cam.z); // print the current position

	glPushMatrix();
	{
		glBindTexture(GL_TEXTURE_2D, tex);
		DrawArea(z);

		for(k = 1, i = z.polis.begin(); i != z.polis.end(); ++i, ++k) // std::list<>::iterator i, int k
		{
			DrawText(10.0, 800 - k * 25, &font, 28, "%d : %.3f", k, (*i).n.Dot(Cam - (*i).a)); // print how far away i am from the walls
		}
	}
	glPopMatrix();
}
glPopMatrix();

SDL_GL_SwapBuffers();
and my DrawText() function
void DrawText(float x, float y, FTFont *font, unsigned int fontsize, char *format, ...)
{
    char *text = new char[256];
    va_list arg;
    va_start(arg, format);
    vsprintf(text, format, arg);
    FTPoint poz(x, y);

    if (font->FaceSize() != fontsize)
    {
        font->FaceSize(fontsize);
    }

    font->Render(text, -1, poz);
  
    delete[] text;
}
can anyone help me get rid of the black background? :)

Share this post


Link to post
Share on other sites

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