how can i display my variables on the screen for real-time testing purposes? i can display strings on screen, but it only accepts “strings” and i always get these errors:
cannot convert parameter from ‘float’ to ‘char *’
where i replace the strings with a different data type…
anyone have any ideas?
thank you =]
Sounds like you’re trying to cast a float into a string, you can’t do that, you need (in most programming languages), to convert it yourself…
CJ
void PrintFloat(float value, int x, int y) {
char c[32];
sprintf(c, "%16.8f", value);
glRasterPos2i(x, y);
glCallLists(strlen(c), GL_UNSIGNED_BYTE, c); }
…assuming that you had a call to glXUseXFont() or something similar before.
is that the best way to go about dispalying variables? is that how you woud do it? if not, how would you?
dvm
May 14, 2005, 4:15pm
6
Well, for C code sprintf is as good as they get. If you want to use pure C++ maybe you’d like to take a look at stringstreams (one word!)
that is the best way for me to show variables on the screen. otherwise i would not have posted it
but to be honest, the best way to watch over variables while running a prog is:
throw away your windows
install linux
now you can run a window-based prog, which may even use opengl, and you still can use >printf< to display whatever you want in a terminal.