Jump to content
  • Advertisement
Sign in to follow this  
phook

FTGL Pixmap font problem

This topic is 3194 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!