rendering contents of a variable in the screen

Ok I know how to draw text in open gl to the screen, but i have a variable that needs to have its contents printed to the screen. Can anyone tell me how this is done. thanks

do you mean formatted text? you have some ints or floats and you want to see what numbers they represent? sprintf

b

if you know how to draw text on the screen
than You want to know how to convert numbers in text right
you can convert an int with the _itoa function
char buffer[10]; // 10 is the maximum number of digits your number can have
_itoa(yourIntVariable, buffer, 10); // 10 means it’s in decimal base…not binary nor octal
then use buffer to draw text

of as coredump said, you can use sprintf like this
char buffer[numberOfDigitsWanted];
sprintf(buffer, “%i”, yourIntVariable);
sprintf(buffer, “%f”, yourFloatVariable);
then use buffer to draw text…
I’m not sure though if numberOfDigitsWanted have to fit the exact length of your number…maybe theere will be a lot of blank of garbage in the buffer variable…
anyway good luck !


Evil-Dog
Let’s have a funny day

And when I say “10 is the maximum number of digits your number can have”
I mean that 10 is the length of the string you will put your number into. So if your number could be like 4500 then use 4…but if it can reach 15 digits use 15…
anyway…


Evil-Dog
Let’s have a funny day