Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void FGAPIENTRY glutBitmapString( void* fontID, const unsigned char *string )
- {
- unsigned char c;
- float x = 0.0f ;
- SFG_Font* font;
- FREEGLUT_EXIT_IF_NOT_INITIALISED ( "glutBitmapString" );
- font = fghFontByID( fontID );
- freeglut_return_if_fail( font );
- if ( !string || ! *string )
- return;
- glPushClientAttrib( GL_CLIENT_PIXEL_STORE_BIT );
- glPixelStorei( GL_UNPACK_SWAP_BYTES, GL_FALSE );
- glPixelStorei( GL_UNPACK_LSB_FIRST, GL_FALSE );
- glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
- glPixelStorei( GL_UNPACK_SKIP_ROWS, 0 );
- glPixelStorei( GL_UNPACK_SKIP_PIXELS, 0 );
- glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
- /*
- * Step through the string, drawing each character.
- * A newline will simply translate the next character's insertion
- * point back to the start of the line and down one line.
- */
- while( ( c = *string++) )
- if( c == '\n' )
- {
- glBitmap ( 0, 0, 0, 0, -x, (float) -font->Height, NULL );
- x = 0.0f;
- }
- else /* Not an EOL, draw the bitmap character */
- {
- const GLubyte* face = font->Characters[ c ];
- glBitmap(
- face[ 0 ], font->Height, /* Bitmap's width and height */
- font->xorig, font->yorig, /* The origin in the font glyph */
- ( float )( face[ 0 ] ), 0.0, /* The raster advance; inc. x,y */
- ( face + 1 ) /* The packed bitmap data... */
- );
- x += ( float )( face[ 0 ] );
- }
- glPopClientAttrib( );
- }
Advertisement
Add Comment
Please, Sign In to add comment