diff --git a/ftgl_testing.cc b/ftgl_testing.cc index 7d7a366..bfe3bea 100644 --- a/ftgl_testing.cc +++ b/ftgl_testing.cc @@ -2,10 +2,15 @@ #include #include #include +#include + +using namespace std; #define WIDTH 500 #define HEIGHT 500 +static FTFont * font; + void init(void) { glViewport(0, 0, WIDTH, HEIGHT); @@ -14,21 +19,27 @@ void init(void) glShadeModel(GL_FLAT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - gluPerspective(60.0, (GLfloat)WIDTH/(GLfloat)WIDTH, 1.0, 30.0); + gluOrtho2D(0, WIDTH, 0, HEIGHT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - glTranslatef(0.0, 0.0, -3.6); + font = new FTTextureFont("/usr/share/fonts/truetype/freefont/FreeMono.ttf"); + if (font->Error()) + { + cerr << "Could not create font" << endl; + } + font->FaceSize(16); } void display(SDL_Window * window) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glBegin(GL_QUADS); - glVertex3f(-2.0, -1.0, 0.0); - glVertex3f(-2.0, 1.0, 0.0); - glVertex3f(0.0, 1.0, 0.0); - glVertex3f(0.0, -1.0, 0.0); + glVertex3f(2.0, 202.0, 0.0); + glVertex3f(2.0, 210.0, 0.0); + glVertex3f(10.0, 210.0, 0.0); + glVertex3f(10.0, 202.0, 0.0); glEnd(); + font->Render("Hello"); SDL_GL_SwapWindow(window); }