http://slackware.bholcomb.com/slackware/slackware-11.0/source/xap/xscreensaver/xscree...
[xscreensaver] / hacks / glx / glut_stroke.c
1
2 /* Copyright (c) Mark J. Kilgard, 1994. */
3
4 /* This program is freely distributable without licensing fees
5    and is provided without guarantee or warrantee expressed or
6    implied. This program is -not- in the public domain. */
7
8 #if 0   /* for Mesa */
9 # include "glutint.h"
10 #else   /* for xscreensaver */
11 # ifdef HAVE_CONFIG_H
12 #  include "config.h"
13 # endif
14 # ifdef HAVE_COCOA
15 #  include <OpenGL/gl.h>
16 # else
17 #  include <GL/gl.h>
18 # endif
19 # undef APIENTRY
20 # define APIENTRY /**/
21 #endif
22
23 #include "glutstroke.h"
24
25 void APIENTRY 
26 glutStrokeCharacter(GLUTstrokeFont font, int c)
27 {
28   const StrokeCharRec *ch;
29   const StrokeRec *stroke;
30   const CoordRec *coord;
31   StrokeFontPtr fontinfo;
32   int i, j;
33
34
35 #if defined(_WIN32)
36   fontinfo = (StrokeFontPtr) __glutFont(font);
37 #else
38   fontinfo = (StrokeFontPtr) font;
39 #endif
40
41   if (c < 0 || c >= fontinfo->num_chars)
42     return;
43   ch = &(fontinfo->ch[c]);
44   if (ch) {
45     for (i = ch->num_strokes, stroke = ch->stroke;
46       i > 0; i--, stroke++) {
47       glBegin(GL_LINE_STRIP);
48       for (j = stroke->num_coords, coord = stroke->coord;
49         j > 0; j--, coord++) {
50         glVertex2f(coord->x, coord->y);
51       }
52       glEnd();
53     }
54     glTranslatef(ch->right, 0.0, 0.0);
55   }
56 }