Debian Codegraph @

test/FTPolygonFont-UnInVec.cpp

raw
1 //$LIBS_PKG_CONFIG glu gl ftgl fontconfig
2 //$LIBS -lglut
3
4 #include <GL/glut.h>
5 #include <FTGL/ftgl.h>
6
7 FTFont *font;
8
9 void display ()
10 {
11 glClear (GL_COLOR_BUFFER_BIT);
12 glMatrixMode (GL_PROJECTION);
13 glLoadIdentity ();
14 gluPerspective (90, 1, 1, 1000);
15 glMatrixMode (GL_MODELVIEW);
16 glLoadIdentity ();
17 gluLookAt (0, 0, 200, 0, 0, 0, 0, 1, 0);
18 glPushMatrix ();
19 glColor3f (1, 1, 1);
20 glEnable (GL_BLEND);
21 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
22 glTranslatef (-100, 100, 0);
23 font->Render ("Test", -1, FTPoint (), FTPoint (), FTGL::RENDER_FRONT | FTGL::RENDER_BACK);
24 glPopMatrix ();
25 glutSwapBuffers ();
26 }
27
28 int main (int argc, char **argv)
29 {
30 glutInit (&argc, argv);
31 glutInitDisplayMode (GLUT_DEPTH | GLUT_RGB | GLUT_DOUBLE | GLUT_MULTISAMPLE);
32 glutInitWindowPosition (50, 50);
33 glutInitWindowSize (400, 400);
34 glutCreateWindow ("FTGL Test");
35 glutDisplayFunc (display);
36 const char *file = "font_pack/timR12-ISO8859-1.pcf.gz";
37 font = new FTPolygonFont (file);
38 if (font->Error () || !font->FaceSize (17))
39 {
40 fprintf (stderr, "Failed to open font %s\n", file);
41 return 1;
42 }
43 glutMainLoop ();
44 }