Hi,
I want to display a set of 3D (float) coordinates on the screen. I know you can use glRasterPos and glutBitmapCharacter to display a character but I am lost on writing float values. Any help is appreciated.
I don’t know, but if you can display any character, can you do something like this:
float x;
char *ptr;
char buf[1024];
x = 3.14 (etc…)
sprintf(buf, “%f”, x);
for(ptr = &buf[0]; ptr; ptr++)
{
display_gl_char(*ptr);
}
use sprintf()
this is what I got to work…
char str[] //storage for string
sprintf(str, “myfloat: %f”, outputVar);
glRasterPos2f(-50, -50);
len = (int)strlen(str);
for (i=0; i<len; i++)
{
glutBitmapCharacter(hudFont, str[i]);
}
[This message has been edited by mike j (edited 02-24-2000).]
Wait a minute. That line has to be:
for(ptr = &buf[0]; *ptr; ptr++)
(Test for null at end of string)
Thanks alot mikej and nickels.
glguru