system
April 21, 2002, 2:50am
1
I’m not able to print the values of variables inside a opengl function(for debugging purposes).
Printf statement works perfectly but it prints either zero or some junk value.
ex:
xcur,ycur-global varables
window_display()
…
printf(“values of %3.2f %3.2f”, &xcur,&ycur);
…
same type of statements not working in keyboard function and other functions
Is there any special setting or special function to do that?
thanks & regards
Owlet
April 21, 2002, 4:31am
2
You’re passing a pointer to the variables to printf as opposed to the variables themselves. You have
printf(…, &xcur, &ycur);
it should be
printf(…, xcur, ycur);
Perhaps you got confused with scanf, which does require you to pass pointers?
Owlet
[This message has been edited by Owlet (edited 04-21-2002).]
DFrey
April 21, 2002, 4:34am
3
If that code example is from your code, then it has problems, because that code above is trying print pointers as floats. Simple get rid of those &'s and it should work fine, assuming those variables really are floats of some type.
Bob
April 21, 2002, 5:21am
4
which does require you to pass pointers?
scanf. And you’re right, no &'s in printf.
system
April 21, 2002, 5:27am
5
oh god, thanks guys.Actually I’m kinda confused since i started using opengl.
once again, thanks guys