- GLvoid glPrint( GLdisplay *display, float red, float green, float blue, const char *fmt, ... )
- {
- char text[256]; /* Holds our string */
- va_list ap; /* Pointer to our list of elements */
- float x, y, height, width;
- height = width = 0.4;
- glBindTexture( GL_TEXTURE_2D, 0 );
- glColor3f(red,green,blue);
- /* Objekt zeichnen */
- glBegin(GL_QUADS);
- glVertex3f( x, y, 0.0f );
- glVertex3f( x+width, y, 0.0f );
- glVertex3f( x+width, y+height, 0.0f );
- glVertex3f( x, y+height, 0.0f );
- glEnd();
- /* If there's no text, do nothing */
- if ( fmt == NULL )
- return;
- /* Parses The String For Variables */
- va_start( ap, fmt );
- /* Converts Symbols To Actual Numbers */
- vsprintf( text, fmt, ap );
- va_end( ap );
- /* Pushes the Display List Bits */
- glPushAttrib( GL_LIST_BIT );
- /* Sets base character to 32 */
- glListBase( display->fontbase - 32 );
- /* Draws the text */
- glCallLists( strlen( text ), GL_UNSIGNED_BYTE, text );
- /* Pops the Display List Bits */
- glPopAttrib( );
- glColor3f(1,1,1);
- }