Printf statement not working inside GLfunctions

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.

xcur,ycur-global varables


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

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?


[This message has been edited by Owlet (edited 04-21-2002).]

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.

which does require you to pass pointers?

scanf. And you’re right, no &'s in printf.

oh god, thanks guys.Actually I’m kinda confused since i started using opengl.

once again, thanks guys