View Full Version : glutBitmapString misses blank spaces

04-06-2012, 05:46 PM
It seems that glutBitmapString misses blank spaces.
I am making an animation, at each time step, I use glutBitmapString to print out some information like this,

sprintf(message, "step=%-8d t=%-15g mass=", step, t);
glutBitmapString(GLUT_BITMAP_HELVETICA_18, (unsigned char*) message);

however, as the variables step ,t, change at each time step, and the message is of different length which should not be ( If I use printf("%s\n",message) to print the same message to screen, it is of exact length and mass aligns at the same column). I need "mass=" to apear at the exact location at each time step.

Anybody else has met the same problem? Any suggestion how to fix it?

04-22-2012, 05:42 AM
work around the problem.
Break the print statement up into two or more parts and use gltranslatef to position the printing of the string.