# FTGL (ttf lib) in orthographic projection

## Recommended Posts

I'm trying to use the FTGL library in ortho projection because my game is purely 2D but i'm having problems with it. I had a function to make the screen's top left corner 0,0 called enable 2D but when i used it FTGL drew the fonts upside down. So i used a function in FTGL's demo and now it draw's in the center of the screen. I don't understand the projection matrices either so some help would be greatly appreciated.
    glMatrixMode (GL_PROJECTION);
glPushMatrix();
gluPerspective(90, (float)GraphicsInstance::SCREEN_WIDTH / (float)GraphicsInstance::SCREEN_HEIGHT, 1, 1000);

glMatrixMode(GL_MODELVIEW);
glPushMatrix();
gluLookAt(0.0, 0.0, (float)GraphicsInstance::SCREEN_HEIGHT / 2.0f, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);

float res = (font->Render(text,length,FTPoint(x,y,0))).X();

glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();



##### Share on other sites
For startskis you're using a perspective projection and frankly that isn't reconciled readily with the fact that you want an orthographic one (i.e. glOrtho). On flipping your y, just reverse the sense of the 3rd and 4th arguments.

##### Share on other sites
i got it fixed :D

i did this
//glEnable2D() called before this. Got it from gamedev.net    glMatrixMode(GL_MODELVIEW);		glPushMatrix();		glScalef(1,-1,1);		    float res = (font->Render(text,length,FTPoint(x,-(y+abs(font->Descender())),0))).X();	    glMatrixMode(GL_MODELVIEW);		glPopMatrix();

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628391
• Total Posts
2982419

• 10
• 9
• 19
• 24
• 11