I would like to show some text (a player score and number of lives left) on the top left corner of my panel.
My game is is a pinball game running in openGL, and I would like to use FTGL to show the text.
My code looks like this
FTGLTextureFont font("./fonts/JambeticaRegular.ttf");
glTranslatef(-150,50,0);
font.FaceSize(32);
font.Render(text);
My problem is that the text follows the pinball table when I move the camera. I want it to be fixed on the upper left corner, never moving, wathever I do with the camera.
Would you have an idea?
EDIT
I tried doing this, instead.
FTGLPixmapFont font("./fonts/JambeticaRegular.ttf");
font.FaceSize(30);
font.Render("Points: ", -1, FTPoint(0, 300, 0));
font.Render("Lives: ", -1, FTPoint(0, 270, 0));
It works in some way, as my text is now fixed, but it's fixed at a distance from the bottom left corner. I would like to have it fixed to the upper left corner. Is there a way?
Before rendering text, try setting matrix again using glLoadIdentity and glOrtho. Or you could save/restore matrices by glPushMatrix/glPopMatrix.