How to pass arguments to call back functions

Dear all,
I am using openGL in multithreading application.
In this I am registering one function with glutDisplayFunc() which is usefull for displaying video and here I am accessing global variables. But in my application global variables should not use.
Instead of global variables is it possible to pass the arguments through callback registering to the callback function?

Please give me some ideas.

Thanks & Regards,
Jayaprakash

You can use the singleton design pattern. It have the same effect of global variables, but if used correctly, should produce better code to understand.

Hi,

with standard glut you probably can’t.

You can try other toolkits that don’t use a callback functions model. SDL would be a good example of that.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.