View Full Version : How to write number bigger than 9?
wzhao53
11-29-2003, 12:27 PM
I used following command to write number and character on the graphic:
glutBitmapCharacter(GLUT_BITMAP_8_BY_13,c[i][j]+48); .
As you can see, if the value in c[i][j] is bigger than 9, it prints out those special characters and ABCD.....
How can I write something like 100 or 15?
Thanks!
maximian
11-29-2003, 12:32 PM
Try extracting each digit in the number
and printing out digit by digit.
You can do this by % the number by 10, and then divide by 10. Keep doing until you hit the digits mark.
nexusone
11-29-2003, 01:44 PM
Here is a routine I wrote to print text on the screen, with glutBitmapCharacter.
usage:
Sprint( 1,1,"12354ABCD")
// I use this to put text on the screen
void Sprint( int x, int y, char *st)
{
int l,i;
l=strlen( st ); // see how many characters are in text string.
glRasterPos2i( x, y); // location to start printing text
for( i=0; i < l; i++) // loop until i is greater then l
{
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, st[i]); // Print a character on the screen
}
}
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.