| 1 |
/* Small C bindings test program */ |
| 2 |
|
| 3 |
#include "config.h" |
| 4 |
|
| 5 |
#if defined HAVE_GL_GLUT_H |
| 6 |
# include <GL/glut.h> |
| 7 |
#elif defined HAVE_GLUT_GLUT_H |
| 8 |
# include <GLUT/glut.h> |
| 9 |
#else |
| 10 |
# error GLUT headers not present |
| 11 |
#endif |
| 12 |
#include <FTGL/ftgl.h> |
| 13 |
|
| 14 |
#define ALLOC(ctor, var, arg) \ |
| 15 |
var = ctor(arg); \ |
| 16 |
if(var == NULL) \ |
| 17 |
return 2 |
| 18 |
|
| 19 |
int main(int argc, char *argv[]) |
| 20 |
{ |
| 21 |
FTGLfont *f[6]; |
| 22 |
char *glutchar = NULL; |
| 23 |
int glutint = 0; |
| 24 |
int i; |
| 25 |
|
| 26 |
if(argc < 2) |
| 27 |
return 1; |
| 28 |
|
| 29 |
glutInit(&glutint, &glutchar); |
| 30 |
glutInitDisplayMode(GLUT_DEPTH | GLUT_RGB | GLUT_DOUBLE | GLUT_MULTISAMPLE); |
| 31 |
glutInitWindowPosition(0, 0); |
| 32 |
glutInitWindowSize(150, 150); |
| 33 |
glutCreateWindow("FTGL C test"); |
| 34 |
|
| 35 |
ALLOC(ftglCreateBitmapFont, f[0], argv[1]); |
| 36 |
ALLOC(ftglCreateExtrudeFont, f[1], argv[1]); |
| 37 |
ALLOC(ftglCreateOutlineFont, f[2], argv[1]); |
| 38 |
ALLOC(ftglCreatePixmapFont, f[3], argv[1]); |
| 39 |
ALLOC(ftglCreatePolygonFont, f[4], argv[1]); |
| 40 |
ALLOC(ftglCreateTextureFont, f[5], argv[1]); |
| 41 |
|
| 42 |
for(i = 0; i < 6; i++) |
| 43 |
ftglRenderFont(f[i], "Hello world", FTGL_RENDER_ALL); |
| 44 |
|
| 45 |
for(i = 0; i < 6; i++) |
| 46 |
ftglSetFontFaceSize(f[i], 37, 72); |
| 47 |
|
| 48 |
for(i = 0; i < 6; i++) |
| 49 |
ftglRenderFont(f[i], "Hello world", FTGL_RENDER_ALL); |
| 50 |
|
| 51 |
for(i = 0; i < 6; i++) |
| 52 |
ftglDestroyFont(f[i]); |
| 53 |
|
| 54 |
return 0; |
| 55 |
} |
| 56 |
|