2 * Mesa 3-D graphics library
4 * Copyright (C) 1995-2006 Brian Paul
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 * Library for glut using mesa fbdev driver
24 * Written by Sean D'Epagnier (c) 2006
26 * To improve on this library, maybe support subwindows or overlays,
27 * I (sean at depagnier dot com) will do my best to help.
31 #include "glutbitmap.h"
33 void glutBitmapCharacter(GLUTbitmapFont font
, int c
)
35 const BitmapCharRec
*ch
;
36 BitmapFontPtr fi
= (BitmapFontPtr
) font
;
39 c
>= fi
->first
+ fi
->num_chars
)
41 ch
= fi
->ch
[c
- fi
->first
];
45 glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT
);
47 glPixelStorei(GL_UNPACK_SWAP_BYTES
, GL_FALSE
);
48 glPixelStorei(GL_UNPACK_LSB_FIRST
, GL_FALSE
);
49 glPixelStorei(GL_UNPACK_ROW_LENGTH
, 0);
50 glPixelStorei(GL_UNPACK_SKIP_ROWS
, 0);
51 glPixelStorei(GL_UNPACK_SKIP_PIXELS
, 0);
52 glPixelStorei(GL_UNPACK_ALIGNMENT
, 1);
53 glBitmap(ch
->width
, ch
->height
, ch
->xorig
, ch
->yorig
,
54 ch
->advance
, 0, ch
->bitmap
);
58 int glutBitmapWidth (GLUTbitmapFont font
, int c
)
60 const BitmapCharRec
*ch
;
61 BitmapFontPtr fi
= (BitmapFontPtr
) font
;
63 if (c
< fi
->first
|| c
>= fi
->first
+ fi
->num_chars
)
65 ch
= fi
->ch
[c
- fi
->first
];
71 int glutBitmapLength(GLUTbitmapFont font
, const unsigned char *string
)
75 for (; *string
; string
++)
76 length
+= glutBitmapWidth(font
, *string
);