home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 5 / MA_Cover_5.iso / ppc / mesa / src-glut / glut_stroke.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-31  |  1003 b   |  44 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 APIENTRY 
  13. glutStrokeCharacter(GLUTstrokeFont font, int c)
  14. {
  15.   const StrokeCharRec *ch;
  16.   const StrokeRec *stroke;
  17.   const CoordRec *coord;
  18.   StrokeFontPtr fontinfo;
  19.   int i, j;
  20.  
  21.  
  22. #if defined(WIN32)
  23.   fontinfo = (StrokeFontPtr) __glutFont(font);
  24. #else
  25.   fontinfo = (StrokeFontPtr) font;
  26. #endif
  27.  
  28.   if (c < 0 || c >= fontinfo->num_chars)
  29.     return;
  30.   ch = &(fontinfo->ch[c]);
  31.   if (ch) {
  32.     for (i = ch->num_strokes, stroke = ch->stroke;
  33.       i > 0; i--, stroke++) {
  34.       glBegin(GL_LINE_STRIP);
  35.       for (j = stroke->num_coords, coord = stroke->coord;
  36.         j > 0; j--, coord++) {
  37.         glVertex2f(coord->x, coord->y);
  38.       }
  39.       glEnd();
  40.     }
  41.     glTranslatef(ch->right, 0.0, 0.0);
  42.   }
  43. }
  44.