home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / src / exampleCode / opengl / GLUT / lib / glut / glut_stroke.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-11  |  879 b   |  37 lines

  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. #include <GL/glut.h>
  9. #include "glutint.h"
  10. #include "glutstroke.h"
  11.  
  12. void
  13. glutStrokeCharacter(GLUTstrokeFont font, int c)
  14. {
  15.   StrokeCharPtr ch;
  16.   StrokePtr stroke;
  17.   CoordPtr coord;
  18.   StrokeFontPtr fontinfo = (StrokeFontPtr) font;
  19.   int i, j;
  20.  
  21.   if (c < 0 || c >= fontinfo->num_chars)
  22.     return;
  23.   ch = &(fontinfo->ch[c]);
  24.   if (ch) {
  25.     for (i = ch->num_strokes, stroke = ch->stroke;
  26.       i > 0; i--, stroke++) {
  27.       glBegin(GL_LINE_STRIP);
  28.       for (j = stroke->num_coords, coord = stroke->coord;
  29.         j > 0; j--, coord++) {
  30.         glVertex2f(coord->x, coord->y);
  31.       }
  32.       glEnd();
  33.     }
  34.     glTranslatef(ch->right, 0.0, 0.0);
  35.   }
  36. }
  37.