Hi programmer people!
I excuse me first of all for my bad english my mother speech is italian…
I want to know WHY can i not write the following commands ins a opengl c based source code:

the same with

why can i not give values trough a callback of function for example as glutIdleFunction???
I can only do that?:


void CalledFunction(void);

The called function MUST be void??? ok thank to all and good evening opengl people!!!

You can pass something like :

int CalledFunction(void);

but the returned integer will be ignored.

And you can pass that :
void CalledFunction(int value);

but it is meaningless because nobody/nothing will pass the argument ‘value’, and moreover may screw up the stack (but the stack may be safe on some compilers and/or processors).

Thank for the fast answer!!
But my problem is how can i call with glutIdleFunction another Function and pass to that dunction a value? there is no way??
Should i make the value global? is that the only way??thanks

i’m not sure why you’d want to pass anything to the idle func. if you need to access some data, just make the variable global. or if you don’t like to use globals, wrap up the glut interface into a class, and make some static member variables to hold the data your idle func needs.


Functions that are used to set callback functions like glutIdleFunction take in a function pointer. That function pointer needs to point to a function with a specific prototype.

Some functions like the Win32 Threading functions allow you to pass extra information that will be passed to the callback function, but cases like that are still very specific to how it is used.