Bugfix for "glutBitmapString" so that it now handles end-of-line characters properly (Richard Rauch)

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@508 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
puggles 2004-08-05 01:11:21 +00:00
parent d916321fd4
commit 0c7fad1ec5

View File

@ -135,22 +135,8 @@ void FGAPIENTRY glutBitmapString( void* fontID, const unsigned char *string )
int c;
int numchar = strlen( (char *) string );
SFG_Font* font = fghFontByID( fontID );
float raster_position[ 4 ];
float x = 0.0f ;
glPushAttrib( GL_TRANSFORM_BIT );
glMatrixMode( GL_MODELVIEW );
glPushMatrix( );
glLoadIdentity( );
glMatrixMode( GL_PROJECTION );
glPushMatrix( );
glLoadIdentity( );
glOrtho(
0, glutGet( GLUT_WINDOW_WIDTH ),
0, glutGet( GLUT_WINDOW_HEIGHT ),
-10, 10
);
glGetFloatv ( GL_CURRENT_RASTER_POSITION, raster_position );
glPushClientAttrib( GL_CLIENT_PIXEL_STORE_BIT );
glPixelStorei( GL_UNPACK_SWAP_BYTES, GL_FALSE );
glPixelStorei( GL_UNPACK_LSB_FIRST, GL_FALSE );
@ -167,8 +153,8 @@ void FGAPIENTRY glutBitmapString( void* fontID, const unsigned char *string )
for( c = 0; c < numchar; c++ )
if( string[c] == '\n' )
{
raster_position[ 1 ] -= ( float )font->Height;
glRasterPos4fv( raster_position );
glBitmap ( 0, 0, 0, 0, -x, (float) -font->Height, NULL );
x = 0.0f;
}
else /* Not an EOL, draw the bitmap character */
{
@ -180,13 +166,11 @@ void FGAPIENTRY glutBitmapString( void* fontID, const unsigned char *string )
( float )( face[ 0 ] ), 0.0, /* The raster advance; inc. x,y */
( face + 1 ) /* The packed bitmap data... */
);
x += ( float )( face[ 0 ] );
}
glPopClientAttrib( );
glPopMatrix( );
glMatrixMode( GL_MODELVIEW );
glPopMatrix( );
glPopAttrib( );
}
/*